Deploying Functions in Visual Studio

Azure Functions lets you execute your code in a serverless environment without having to first create a VM or publish a web application.

This blog post shows how to use the Visual Studio 2017 tools for Azure Functions to locally create and test a function. You then publish the function code to Azure.

These tools are available as part of the Azure development workload in Visual Studio 2017.

Prerequisites

 

Create a function app project

 

The Azure Functions project template in Visual Studio creates a project that can be published to a function app in Azure. A function app lets you group functions as a logical unit for management, deployment, and sharing of resources.

In Visual Studio, select New > Project from the File menu.

In the New Project dialog, select Installed, expand Visual C# > Cloud, select Azure Functions, type a Name for your project, and click OK.

Use the settings specified in the table that follows the image

Click OK to create the function project and Empty function.

Right-click on the project > Add > New Item

Select Azure Function and click Add

 

Select Generic Webhook, then ok

 

Function created

    Publish the project to Azure

In Solution Explorer, right-click the project and select Publish.

Select Azure Function App, choose Create New, and then select Publish.

If you haven’t already connected Visual Studio to your Azure account, select Add an account….

In the Create App Service dialog, use the Hosting settings as specified in the table below the image:

Click Create to create a function app and related resources in Azure with these settings and deploy your function project code.

After the deployment is complete, make a note of the Site URL value, which is the address of your function app in Azure.

Test the function

Paste the URL for the HTTP request into your browser’s address bar.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s