Publishing HTTP Trigger Azure Function using VS 2017 v15.3



In this blog we shall learn how to develop Microsoft serverless offering Azure functions using Visual Studio 2017 v15.3 (preview)

For Cloud developers, aspiring azure learners and all other IT professionals associated with the serverless architecture learning, especially with Microsoft Azure and ASP.NET development company, this blog would very much help to get started with Azure Functions.

Quick Overview

Microsoft Azure’s service offering for Serverless Architecture Model is known as Azure Functions. Azure’s consumption plan, an exclusive App plan for Azure Functions, makes it one of the key choice of enterprise for executing small piece of code on Cloud. Also implementation involves no complex configuration, making it super cool service to start with

At the time of writing, latest release of Visual Studio i.e. 2017 v15.3 & .NET Core 2.0, comes in with predefined Azure Functions templates with getting started code snippets. Addition of this templates, makes developer focus more on functional implementation with higher productivity.

Let’s make use of one of the predefined templates, HttpTrigger, for having clearer understanding.

1) Microsoft Azure Subscription (You can have your free trial subscription, by clicking here )
2) .NET Core 2.0 – Click here to download
3) Visual Studio 2017 V15.3 Preview – Click here to download

Azure Function Type – HttpTrigger
Open Visual Studio v15.3 => Click on File => New project
Select Cloud => Azure Functions
Give a meaningful name for project, for this blog we have given project name as ‘HttpTriggerFunction’
Click OK

This will create project with basic project structure.

It comes with all necessary assemblies and NuGet packages for .NET Sdks required for Azure Functions, along with two json files naming host.json and local.settings.json

Now let’s add Function template HttpTrigger in to our application.
Go to Solution Explorer => Right Click on Project
Select Add => New Item
This will open up list of Function Templates available.
Select HttpTrigger Functional template => Provide name as ‘HttpTrigger.cs’
Click OK

Class file with name ‘HttpTrigger.cs’ is now added in to application.
This will contains sample code for execution on any Http request comes in.
Run method is decorated with FunctionName attribute, which indicates entry point for execution.
About the code
This code would respond to GET request with ‘name’ as parameter, and would display the value being passed in parameter.

Test Azure Function Locally
Build and Run the application.
This will spin up the code, and a Console window with all details will get open up.
It will provide a localhost URL for accessing our Azure Function, so now our function is running.
URL: http://{localhost}/api/HttpTrigger ; Copy the URL
Refer below image.

Open the browser and paste the URL copied from console window.
Pass some value for parameter ‘name’, here we have passed as ‘Hello Debugging From Visual Studio 2017’
We can see the same as response.

Keep the application in running mode.
Place a debugger point in Run method.
Hit refresh in browser opened with function URL as mentioned above.
We can see pointer coming in at our debugger point.
Mouse-over at ‘name’ variable, we can see the value being passed.

So now our Azure Function with HttpTrigger is running fine locally.
For Live implementation we need this Azure Function to be public URL. Or in other words on Cloud i.e. Azure Function App.

Publishing to Azure Functions using Visual Studio 2017
Visual Studio 2017 v15.3 not only supports Azure Function’s development and debugging but also has the capability for publishing this application to Azure as Function App.
Open Solution Explorer => Right Click on project name => Click ‘Publish’

This will open a window with Publish tab listing three different publish options,
a) Azure Function App
b) Folder
c) Import profile

For this blog, will shall go with Azure Function App as publishing option.
Select Azure Function App and Create New as we are publishing for the first time.
Click on Publish.

This is the most important step, wherein you have to fill in all required details which would publish and deploy your Azure Function app on Azure.
Ensure to be logged in with your Microsoft Azure account with subscription.
a) App Name: Is a globally unique Function App name. It suggest with default name for App. Let’s go with default name.
b) Subscription: It will list your subscription associate with your logged in account. If you have multiple subscription, you can select any one from it.
c) Resource Group: Azure Function being an Azure resource needs to be deployed under Resource group. You can select existing Resource group or create new.
d) App Service Plan: Pricing plan for Application. As it’s a Function App we can select consumption plan wherein it will charge only on execution of code.
e) Storage Account: You can create a new storage account or select from existing storage accounts.

Point to Remember: Better to create Storage account from Azure portal and then select the same from this window.

Click on New button next to App Service Plan for setting up the plan.
Let’s go with default name and Location for App service plan.
Under Size => Select ‘Consumption’ from dropdown list.
Click OK

Once done with entering all required details, click on Create.

Open Microsoft Azure Portal
Navigate to Resource group we deployed our Azure Functions.
Function App, App service plan and Storage resources can be seen being deployed.

Click on newly created Azure Function App.

We can see our HttpTrigger function under left navigation pane under FunctionsApp.
Click on Test as highlighted in below image.

Under Query section
Enter value for parameter name.
For this blog, we entered value as ‘Hello Azure Function from Visual Studio”
Click on Run
We can see the output status as 200 OK
And Output response as the value we entered.
Also this execution details can be seen under Log section.
Refer below image, highlighted section.

Now, Click on Get Function URL link placed next to Run button.
Copy the URL by clicking on Copy link at right hand side of popped up window.

Open browser and paste the URL.
Pass some value for parameter ‘name’, here we have passed as ‘Hello Debugging From Visual Studio 2017’
We can see the same as response.

Modify and Publish Azure Function App

Let’s modify some lines of code in HttpTrigger.cs => Run method.
Refer below image for changes being made.

Again publish the application.
Repeat the same steps as mentioned above for publishing.

Open browser with our Live function URL we copied from ‘Get Function URL’ link.
We can see the response as per modified code.

Also copy the Site URL of our Function App.
We can have this URL from,
a) Azure portal => Function App => Overview Tabb) Visual Studio Publish window

Open this URL in browser.
This too confirms our Function App is up and running fine on Microsoft’s Public Cloud, Azure!


In this blog we learned how seamlessly we can develop and publish an Azure Functions on Cloud with no complex configuration and with super cool consumption plan using Visual Studio 2017 v15.3. Also modifying and republishing was achieved on fewer clicks.

Would recommend to try out with Azure Functions HttpTrigger function type and make your application smart and cost effective.
Thank You.



Chirag thumar is working as a senior web developers in India at NEX, NEX is leading web development Company in India and USA. He runs his own company main focus Java based web application using JQuery, Struts, JSF, node.Js, spring, Ext Js, etc. He Writes about Emergency technology, Java based frameworks & tools, Innovative quotes, Social Media News and online marketing.

Leave a Reply

Your email address will not be published. Required fields are marked *