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.
Log in to Azure
Log in to the Azure portal.
Create a function app
Click the New button found on the upper left-hand corner of the Azure portal.
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.
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.
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.
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.
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.
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=yournameto 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.
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:
- Best Practices for Azure Functions
- Azure Functions developer reference
Programmer reference for coding functions and defining triggers and bindings.
- Testing Azure Functions
Describes various tools and techniques for testing your functions.
- How to scale Azure Functions
Discusses service plans available with Azure Functions, including the Consumption hosting plan, and how to choose the right plan.
- What is Azure App Service?
Azure Functions uses the Azure App Service platform for core functionality like deployments, environment variables, and diagnostics.
Need some help?
Post questions in the Azure forums. - Visit MSDN
Tag questions with the keyword
azure-functions. - Visit Stack Overflow