Trigger Azure Function From Microsoft Flow

In this article, we are going to see how to trigger the Azure function from Microsoft Flow. Before reading this article, it is expected that you have basic knowledge of MS Flow and creating the Microsoft Flow.

 Introduction

In this article, we are going to see how to trigger the Azure function from Microsoft Flow. Before reading this article, it is expected that you have basic knowledge of MS Flow and creating the Flow.

Microsoft Flow is a cloud based software tool that allows employees to create and automate workflows across multiple applications and services without the need for developer help. Automated workflows are called flows. To create a flow, the user specifies what function should take place when specific event occurs.

Modules

  • Creating simple Azure function.
  • Integrate Azure function with MS Flow using ‘HTTP Action’
Develop Azure Function

In two ways, we can create the Azure functions.

Go to https://funcitons.azure.com and click Get started. This will allow you to try out Azure functions for the limited time (one hour).

In case you already have existing Azure subscription, you can use that for creating Azure function.

Go to Azure market place and click compute. Then, click function app and enter the below values depending on your requirement.

 

You can use your development language of choice, such as C#, F#, Node.js, Python and PHP. I have chosen JavaScript.

 

The code should look like below and we will use the default code.

 

The function is ready to be used and you can run it in the test tab provided at the side.

 

You should see "Hello Muthusamy" as an output.

Trigger Azure function from MS Flow:

On the SharePoint site, I created custom list called “PowerApp”. Open Flow from list top bar.

 

Creating the flow

We start creating the flow by registering our SharePoint site. For this, we open the Settings menu at the top of the page.

Note

Flow has a lot of pre-built templates. If you want, you can use the templates based on your requirement.

Here, I have selected blank flow (Create from blank).

 

Let’s create our new flow now. The first step in the flow will be a trigger for new item in our custom list.

The next page looks like below >> click SharePoint logo from that page.

 

You should see the list of SharePoint events. Choose “SharePoint – When a new item is created” option.

 

Provide the below mandatory parameters and click Next action.

Site Address - your site URL

List Name - select your list name from dropdown list.

 

Click next step >> Add action, then select “HTTP Action”.

 

In http action, you should give the below values.

Method - Post

URI - Copy the azure function URL from Get function URL link in azure function page.

Headers - Not Mandatory

Body - { “name” : “”}

 

Here, I selected the item created by display name as an input of azure function.

Let’s add one additional step: email to manager.

Body: select the output of http action

 

After configuring the mail action, save the flow by clicking on the checkmark at the top of the page.

Running flow

Now, add the new item in custom list. After a few moments, you will get an email from mail that looks like this.

 
Key Notes
  • Develop the Azure function
  • Create the Custom list
  • Develop the Flow and integrate Azure function and flow