Skip to content

Latest commit

 

History

History
72 lines (41 loc) · 4.83 KB

functions-create-function-app-portal.md

File metadata and controls

72 lines (41 loc) · 4.83 KB
title description ms.topic ms.date ms.custom
Create your first function in the Azure portal
Learn how to create your first Azure Function for serverless execution using the Azure portal.
how-to
03/26/2020
devx-track-csharp, mvc, devcenter, cc996988-fb4f-47

Create your first function in the Azure portal

Azure Functions lets you run your code in a serverless environment without having to first create a virtual machine (VM) or publish a web application. In this article, you learn how to use Azure Functions to create a "hello world" HTTP trigger function in the Azure portal.

[!INCLUDE functions-in-portal-editing-note]

We instead recommend that you develop your functions locally and publish to a function app in Azure.
Use one of the following links to get started with your chosen local development environment and language:

Visual Studio Code Terminal/command prompt Visual Studio
• Get started with C#
• Get started with Java
• Get started with JavaScript
• Get started with PowerShell
• Get started with Python
• Get started with C#
• Get started with Java
• Get started with JavaScript
• Get started with PowerShell
• Get started with Python
Get started with C#

[!INCLUDE quickstarts-free-trial-note]

Sign in to Azure

Sign in to the Azure portal with your Azure account.

Create a function app

You must have a function app to host the execution of your functions. A function app lets you group functions as a logical unit for easier management, deployment, scaling, and sharing of resources.

[!INCLUDE Create function app Azure portal]

Next, create a function in the new function app.

Create an HTTP trigger function

  1. From the left menu of the Functions window, select Functions, then select Add from the top menu.

  2. From the Add Function window, select the Http trigger template.

    Choose HTTP trigger function

  3. Under Template details use HttpExample for New Function, choose Anonymous from the Authorization level drop-down list, and then select Add.

    Azure creates the HTTP trigger function. Now, you can run the new function by sending an HTTP request.

Test the function

  1. In your new HTTP trigger function, select Code + Test from the left menu, then select Get function URL from the top menu.

    Select Get function URL

  2. In the Get function URL dialog box, select default from the drop-down list, and then select the Copy to clipboard icon.

    Copy the function URL from the Azure portal

  3. Paste the function URL into your browser's address bar. Add the query string value ?name=<your_name> to the end of this URL and press Enter to run the request. The browser should display a response message that echoes back your query string value.

    If the request URL included an access key (?code=...), it means you choose Function instead of Anonymous access level when creating the function. In this case, you should instead append &name=<your_name>.

  4. When your function runs, trace information is written to the logs. To see the trace output, return to the Code + Test page in the portal and expand the Logs arrow at the bottom of the page. Call your function again to see trace output written to the logs.

    :::image type="content" source="media/functions-create-first-azure-function/function-view-logs.png" alt-text="Functions log viewer in the Azure portal":::

Clean up resources

[!INCLUDE Clean-up resources]

Next steps

[!INCLUDE Next steps note]