Create your first function in the Azure portal

This topic shows you how to use Azure Functions to create a "hello world" function that is invoked by an HTTP request. Before you can create a function in the Azure portal, you must create a function app to host the serverless execution of your function.

To complete this quickstart, you must have an Azure account. Free accounts are available. You can also try Azure Functions without having to register with Azure.

Log in to Azure

Log in to the Azure portal.

Create a function app

  1. Click the New button found on the upper left-hand corner of the Azure portal.

  2. Click Compute > Function App, select your Subscription, type a unique App name that identifies your function app, then specify the following settings:

    • Resource Group: Select Create new and enter a name for your new resource group.
    • Hosting plan, which can be one of these plans:
      • Consumption plan: The default plan type for Azure Functions. When you choose a consumption plan, you must also choose the Location.
      • App Service plan: An App Service plan requires you to create an App Service plan/location or select an existing one. These settings determine the location, features, cost, and compute resources associated with your app.
    • Storage account: Each function app requires a storage account. You can either choose an existing storage account or create a storage account.

      Create function app in the Azure portal

  3. Click Create to provision and deploy the new function app.

For more information, see Create a function app from the Azure portal.

Create a function

These steps create a function in the new function app by using the Azure Functions quickstart.

  1. Click the New button, then click WebHook + API, choose a language for your function, and click Create a function. A function is created in your chosen language using the HTTP triggered function template.

After the function is created, you can test it by sending an HTTP request.

Test the function

Since the function templates contain working code, you can immediately test your new function right in the portal.

  1. In your function app, click the new function and review the code from the template. Notice that the function expects an HTTP request with a name value passed either in the message body or in a query string. When the function runs, this value is returned in the response message. The example shown is a JavaScript function.

  2. Click Run to run the function. You see that execution is triggered by a test HTTP request, information is written to the logs, and the "hello..." response is displayed in the Output in the Test tab.

  3. In the Request body text box, change the value of the name property to your name, and click Run again. This time, the response in the Output contains your name.

  4. To trigger execution of the same function from an HTTP testing tool or from another browser window, click </> Get function URL, copy the request URL and paste it into the tool or browser address bar. Append the query string value &name=yourname to the URL and execute the request. The same information is written to the logs and the same string is contained in the body of the response message.

Next steps

This quickstart demonstrates a simple execution of a basic HTTP-triggered function. To learn more about using Azure Functions in your apps, see the following topics:

Need some help?

Post questions in the Azure forums. - Visit MSDN

Tag questions with the keyword azure-functions. - Visit Stack Overflow