Skip to main content

HSD’s Senior Technical Consultant (Dynamics 365), Ashley Fonseca is back with a new blog post that runs through some in-depth Microsoft Azure training, guiding you through the creation of an Azure Function.

In Power Automate Flow, a HTTP request action can be used to call an Azure Function. For example, you can write a JavaScript code in Azure Function and then call it from Flow. Currently Logic Apps supports writing inline code, however, there are limitations based on the azure resource groups used. Some functions can be done directly in Power Automate/LogicApps using in-built expressions and functions of the platform. But it’s much easier to write JavaScript code than trying to solve complex functions using expressions. Azure Function will allow us to create complex code that we can run it from Power Automate Flow and Logic Apps.

We can use existing HTTP request actions to call an Azure Function. The only problem is every time a developer wants to use this Azure Function, they will have to configure the HTTP request connector. We can alternatively create a custom connector where Azure Function URL and Key is stored and then the developer can simply use this custom connector to call Azure Function without having to know the URL or security key. This is also much easier to maintain as well. If the URL or Key is changed then we can simply alter the data connection that is used in custom connector.

In this exercise we will create an Azure Function, then create a Flow and use out of the box HTTP actions to call the function. Once this is working we will create a Custom Connector and use this new connector in our flow.

Create a Azure Function App

  1. Login to https://portal.azure.com/
  2. Click on Function App and click ‘+ Add’ button
  3. Create Resource Group if you don’t already have one
  4. Enter name and all other mandatory fields. Select Node.js as Runtime stack because we want to use this function in Flow, Flow interfaces in JSON


  5. Click on Create
  6. Once deployment is complete click on ‘Go to resource’
  7. Click on Functions and click on ‘+ Add’
  8. Select HTTP trigger template from right panel
  9. Enter function name ‘DemoProcess’ and click Add
  10. Click on ‘Code + Test’ under Developer tab
  11. For the purpose of demo keep the existing function code.
  12. Click on ‘Get function URL’ from menu and then click on the copy icon. This function url will be used in Flow.

Create a Flow using HTTP Connector

  1. Login to https://make.powerapps.com/
  2. Go to Flows tab and click on ‘+ New flow’
  3. Select ‘Instant Cloud flow’
  4. Select ‘Manually trigger a flow’ and click Create
  5. Select ‘Add a input’ and click on Text icon


  6. Add a new step and search for “http” and click on HTTP action. This is HTTP connector
  7. In HTTP connector, select method as POST
  8. In URL field, paste the URL you had copied previously
  9. In Body, write code as below:
    return “@{triggerBody()[‘text’]}”
  10. Save


  11. Click the Text button, select manually and click Test at bottom
  12. Enter any input value and click ‘Run flow’
  13. In HTTP response, you see the Body that was returned by Azure Function

The problem with HTTP connector is that we expose the full Azure Function URL including security code. Power App developers get access to this code. If you want to hide this endpoint and security code we can create a custom connector.

Create custom connector

  1. Login to Power Apps
  2. Expand Data tab and click on ‘Custom Connectors’
  3. Click on ‘+ New custom connector’ – Create from blank
  4. In General tab enter Host and Base URL that you had copied while creating Azure Function. Do not enter security key.


  5. Go to Security tab and select Authentication type as API Key
  6. In API Key box
    • Enter ‘Key’ in Parameter label
    • Enter ‘x-functions-key’ as parameter name
    • Keep Header in parameter location


  7. Go to Definition tab and click ‘New action’
  8. In General tab
    • Enter ‘Demo’ in Summary field
    • Enter ‘Custom Connector Demo’ in Description field
    • Enter ‘DemoConnector’ in Operation ID
    • Under Visibility click ‘important’


  9. Go to Definition tab and click ‘New action’
  10. In General tab
    • Enter ‘Demo’ in Summary field
    • Enter ‘Custom Connector Demo’ in Description field
    • Enter ‘DemoConnector’ in Operation ID
    • Under Visibility click ‘important


  11. In Request you will see the parameter called ‘ParamName’. Import function has created this parameter for us. You can click on “” to edit this parameter. You can make it mandatory if you’d like and change type number or array as per your requirements.
  12. Now go to the ‘Response’ section and click on default, this will bring up Response form
  13. Here click on ‘+ Import from sample’ button set response
  14. In Import from sample form enter Body field as below and click Import
    {
    “response”: null
    }
  15. Click “Create connector”
  16. After the connector is created, you will notice that in the “Request” section, “Body” is empty and we cannot edit it


  17. To fix this click on Swagger Editor on top

  18. In “Definition code”, manually add the body parameter. Under parameters add line below


  19. Click ‘Update Connector
  20. Click on the ‘Test‘ tab to test this connector
  21. In Connections section click ‘+ New connection’, add Key and click Create.
    In Azure Function URL there is key parameter after ‘code=’. Copy this whole key in Key field
  22. In Operations section;
    • Enter Param Name as Parameter1
    • Click Raw Body switch and enter response body parameter


  23. Click ‘Test’ operation
  24. In few seconds you will see response from Azure Function


Create a Flow using Custom Connector

  1. Login to https://make.powerapps.com/
  2. Go to Flows tab and click on ‘+ New flow’
  3. Select Instant Cloud flow
  4. Select Manually trigger a flow and click ‘Create’
  5. Select ‘Add an input’ and click on ‘Text’ icon


  6. Add new Step
  7. Under ‘Choose an Action’ select custom tab and select your custom connector


  8. Enter Body script and optional parameter and Save
  9. Click Test – Manually  – Continue
  10. Enter Input value and click Run flow

Be sure to keep up to date with all of HSD‘s news and content here and on our LinkedIn.