Try for free Book a demo

How to provision Azure Functions in Visual Studio and publish to Azure Portal

Microsoft Azure

3 Mins Read

How to provision Azure Functions in visual studio and publish to Azure portal-01

In this blog post, let us look at how to provision an Azure Function in Visual Studio and publish to the Azure portal. In addition, this blog also covers how to integrate the published Azure Function to a project in Microsoft Flow. It is a continuation of the Whitepaper – How to extract email attachment with Microsoft Flow.


  1. Visual Studio 2017 V15 or above
  2. Azure Subscription

Let us start with Provisioning a Function in Visual Studio

  1. Provisioning Function App in Visual Studio
    • Open Visual Studio and go to File-> New-> Project
    • In the New Project window, Select Azure Functions under visual C#
      1.New Project
    • Fill the Name field with custom name “checkIfSignaturePicture” and Click OK
    • In the new window that pop-up, select Run-Time version as “v2” and the trigger as “HTTP trigger” and Click Ok

      Now, a new project would have created with some default sample code in it.

  2. Replace the default code
    • Delete the existing default code and paste the below-mentioned code. This plays a vital role in determining the signature picture and the actual attachment.
    • using Microsoft.Azure.WebJobs;
      using Newtonsoft.Json;
      using System.Threading.Tasks;
      using System;
      using HtmlAgilityPack;
      using System.Net.Http;
      using Microsoft.Extensions.Logging;
      namespace checkIfSignaturePicture
          public static class checkIfSignaturePicture
              public static async Task<bool> Run(HttpRequestMessage req, ILogger log)
                  bool isSignature = false;
                      string jsonContent = await req.Content.ReadAsStringAsync();
                      dynamic data = JsonConvert.DeserializeObject(jsonContent);
                      HtmlDocument htmlDoc = new HtmlDocument();
                      var htmlNodes = htmlDoc.DocumentNode.SelectNodes("//img");
                      foreach (var node in htmlNodes)
                          if (node.OuterHtml.Contains(data["PictureName"].Value))
                              isSignature = true;
                  catch (Exception ex)
                  return isSignature;
    • You need to add the HtmlAgilityPack library to initialize HtmlDocument class which is used to retrieve the content of the img tag.
    • 3.HtmlAgilityPack

    • The Function returns Boolean value based on the image depicted.
  3. Publish to Azure Portal
    • Right Click on the project name which you can find on the right side of the screen and select publish
    • 4. publish

    • In the new window which appear, select “Create New” option and hit Publish
    • A new window would appear now with set of options, select the appropriate subscription, resource group and click Create
    • 5.PublishCred

    • Now, you should see the publish process that has been started
    • Lastly, push “Publish” button to publish the Function App to the Azure portal

Azure Portal

Now, head to the Azure portal and follow the steps described below;

  1. Login in with your Azure Subscription account
  2. Click on the Function App in the left navigation bar
  3. 7. Azure portal home page

  4. The new window that appears may contain the list of Function App name. Select the right App that you have published from the Visual Studio, checkIfSignaturePicture.
  5. 8. list of functions

  6. Click on the appropriate App and you will be navigated to a new window
  7. Select the function inside the Function App from the left navigation bar
  8. You can now see the function is in read-only mode as it is published from Visual Studio
  9. Now, copy the function URL or endpoint from “Get function URL”
  10. collage

Integrate the Azure Function with Microsoft Flow

Head to the Microsoft Flow project and paste the copied Function URL or endpoint in the HTTP request action under URI field. The HTTP action uses this endpoint to send the parameters to the function in the portal and in return sends a response.

9. Integration with Flow


In this blog, we have seen how to provision an Azure function in Visual Studio and Publish to the Azure Portal. Also, it described on integrating the Azure Function in the portal with Microsoft flow.

This article was published on Jul 10, 2019.

Related Articles