Calling an Azure Function from MS Flow

In this blog, we will see how to call an azure function from MS flow.
 
Prerequisite
  • Function APP should be created
  • MS Flow license (O365 E3 Developer) should be there

Create an Azure Function

 
First, we will create an Azure Function in a function APP. Please follow below steps.
 
 
 
1. To create an Azure Function, click on the + sign next to Functions
 
2. You will get below screen
 
 
 
3. You can create your function in any language mentioned above. For the time being we will go ahead with In-Portal development
 
4. Select In portal option and click on continue.
 
5. You will get below screen, which shows the templates. As we know the azure functions are nothing but web apis so we will be going ahead and selecting ‘Webhook+API’
 
 
 
6. Click on ‘Create’ button.
 
7. You will get a default function created with below coding
 
 
 
8. We will save this and will run the function.
 
9. To run, we can click on ‘Run’ button or we can have the function url by clicking ‘Get Function URL’.
 
10. On clicking on Run button, we have to enter the ‘name’ query string. By default it will be ‘name=Azure’. You can change it as per your wish.
 
 
 
11. Now to call this function from browser we need the url. Click on the ‘Get Function URL’
 
 
 
Moreover, copy the url from the next screen.
 
 
 
12. Go to browser and enter this url and add name query string parameter as ‘&name=Sandeep’
 
 
 
In the next section, we will see how to call function app with MS Flow.
 

Calling the Azure function from MS Flow

 
1. Go to https://flow.microsoft.com
 
2. Go to My Flows and click on ‘New’
 
 
 
3. Choose ‘instant from blank and select ‘From Microsoft Flow’, give some name and click on ‘Create’
 
 
 
4. You will have your flow created with Manual Trigger
 
 
 
5. Click on ‘New Step’ and search for ‘http’ in the action popup
 
 
 
6. Once HTTP action is added, select ‘Put’ from the dropdown next to Method and enter the function url (along with name query string) in the ‘Uri’ section.
 
 
 
7. If you click on ‘Show advanced option’ you can see Authentication settings which is set to ‘None’
 
 
8. For the time being, we will go ahead with this and click on Save button.
 

Test the Flow

 
1. To test the flow, click on the Test button next to ‘Flow Checker’
 
 
 
2. Click on ‘I ‘ll perform the trigger action’ and click test.
 
 
 
3. Click on ‘Run Flow’ on the next screen
 
 
 
4. Click See flow run activity from next screen.
 
 
 
5. You can see the flow has executed successfully.
 
 
 
6. Select the run history, and clicking on this will take you the flow status as shown in below screen.
 
 
 
7. You can see the body of the HTTP action, it has ‘Hello, Sandeep’ as outcome.
 
In this blog, we have seen how to call an Azure function from MS Flow. However, we have not considered the Authentication part. If you remember, we have not set the authentication in the Function APP
 
To see the authentication is set or not, go to Function APP -> Platform Features -> Authentication and you can see it is turned off.
 
 
 
In the next post we will set up the Authentication and will see how to call an AAD (Azure Active Directory) enabled azure function from MS Flow.