How to deploy Azure Function from Visual Studio

Recently, I created an Azure Function for one of my clients, and the steps mentioned in this article helped me to deploy Azure function from Visual Studio. This article will discuss how to deploy Azure Function from Visual Studio.

Deploy Azure Function from Visual Studio

If you have not created your Azure Function till now, you can Create your Azure Function In Visual Studio and then follow the below steps to deploy it to Azure.

1. The first step is to right-click on the project from Solution Explorer and select the “Publish” Option like below.

Deploying the Azure Function using Visual Studio

2. On the Pick a publish target window, choose the Azure Functions Consumption Plan, and then you can select the Existing plan if you have or Choose the Create New option and then click on the Create Profile button to create the new Azure Functions Consumption Plan.

Deploying the Azure Function using Visual Studio

3. Now, on the App Service window, Provide a name, choose your subscription, Choose your Resource group, Select the Location, and then choose your Existing Storage Account or click on the New button to create a new Azure Storage Account and then finally click on the Create button.

Deploying the Azure Function using Visual Studio 2017

4. Now you can see the publish profile will be created like below. Now click on the Publish button.

Deploying the Azure Function using Visual Studio 2015

5. You can now see the App services we created.

Deploying the Azure Function using Visual Studio IDE

Now click on that, and then click on the Functions from the left navigation, you can see the Function that you published from VisualStudio.

publish azure function from visual studio 2019

Click on the Function. In my case, it is Function1, then click the Get Function Url. Now click on the Copy button to copy the complete function URL as highlighted below

publish azure function from visual studio

Now, you can use this URL in the Postman app to check if it works.

The URL will be like below

Open the Postman app again, paste the above URL, choose the POST option, and now click on the Send button. It asks to pass a name on the query string or in the request body.

create azure function in visual studio 2017

Now, Choose the raw option, select the JSON format, use the same format as below for the name parameter, and specify a name. You can see it provides us with the expected output below.

create azure function in visual studio 2019

So, we discussed Deploying the Azure Function using Visual Studio 2019 by following the above-mentioned steps.

Conclusion

This Azure article discussed how to deploy Azure Function from Visual Studio. Thanks for reading this article !!!