Updated: Mar 18, 2019
Azure Functions is used for executing a small piece of code or “function” in a cloud and you pay only for the time your code executes. You can use any development language of choice, such as C#, F#, PHP, Java etc. Some of the key features of Functions are Choice of language, Pay-per-use pricing model, bring your own dependencies, integrated security, simplified integration, flexible development, and open-source. Please refer Azure Functions for more details or read my previous articles.
In this article, you will see how to create an Azure Functions app using Visual Studio 2017. Visual Studio 2017 version 15.4 or later including the Azure Development workload is required.
Create Azure Functions app using Visual Studio
Open Visual Studio 2017.
Click File -> New -> Project.
Select Azure Functions template, enter the name of the Functions app, and click "OK".
Functions App is created with the following structure.
Right-click the solution, click Add, and then click "New Item".
Select Azure Function, enter the Name, and click Add.
Select Http trigger with parameters and access rights as Anonymous. Click OK.
Function code file is added as shown below.
Test the function locally
Hit F5. You need to install Azure Functions CLI tools to run this project. Click "Yes".
Click "Allow access".
Copy the URL and paste it into the browser. The function will return the results.
You could also place the breakpoints and debug the code.
Publish to Azure
Right-click the solution and click "Publish".
Add an account, select the subscription, select an existing Resource Group or create a new one, and add an App Service Plan. Click "Create".
Log in to the Azure Portal and navigate to Azure Functions. You will be able to see the newly created Functions App.
Run the function to see the output and logs.
Thus, in this article, you saw how to create an Azure Functions App using Visual Studio 2017.