Create and Publish Azure Functions using Visual Studio

Creating azure functions using visual studio is very simple. The following simple steps guide you to create and publish Azure functions.

Create Azure Function

Open visual studio 2017 and select create new project from File menu

Enter Name, Location and solution name as you like. For this example, I give the name “AzureFuntionDemo”

In the Next Screen, choose the framework “Azure Functions v2 (.NET Core)”, select “Http trigger” function and select Access rights as “Anonymous”.

Note: You can also choose other options “Function” or “Admin”. I will explain these options in other post.

After clicking ok button, a sample code snippet generated to get name as parameter from the http request and display it.


Now, you can build and run the application by click F5 to test the function locally. A command prompt will appear with local site url to access the function. Copy the URL and run from the browser.

You will get the below message if you are not passing the Name parameter

The below message will appear once you pass the name parameter

Now we have created and run the application locally. The following steps guide you to deploy functions in Azure portal.

Note: You can include your functionality in the code before you publish

Deploy The function to Azure

Select “Publish” from solution explorer.

Click “Create Profile” button then provide the following information in the pop-up window

  1. Login with Azure account
  2. Enter Azure App Name
  3. Choose subscription
  4. Resource Group – select existing or create new one
  5. Hosting Plan – Select the existing or create new one by click new
  6. Storage account – Provide storage account name if you have already or create the new one

Click “Create” once you provide the above information. By clicking create, New Azure Function App will be created in azure portal under the resource group you have selected.

Click Publish. Your function will be published in azure and you can see this under Azure function app

After successful publish, you can copy the azure function URL (site URL in the below screenshot) to access.  

Open the browser and access the function by replacing the localhost url by the azure url.

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Leave a Reply