top of page

How to create custom connector to get the flow run history

Here are the steps to create the custom connector to get the specified flow run history in a specified environment.

Swagger file:

swagger: '2.0'
info: {title: Flow Run History, description: '', version: '1.0'}
host: us.api.flow.microsoft.com
basePath: /
schemes: [https]
consumes: []
produces: []
paths:
  /providers/Microsoft.ProcessSimple/environments/{environment_name}/flows/{flow_name}/runs:
    get:
      responses:
        default:
          description: default
          schema: {}
      summary: Get Flow Run History
      description: Get the run history of specified flow in specified environment
      operationId: GetFlowRunHistory
      x-ms-visibility: important
      parameters:
      - {name: environment_name, in: path, required: true, type: string, default: Default-82e5f1fb-9ffd-49c1-b0e1-1aae52374ff1,
        x-ms-visibility: important, description: Environment ID}
      - {name: flow_name, in: path, required: true, type: string, default: 39190573-dbe9-40a2-a99f-183bb2a3fd31,
        x-ms-visibility: important, description: Flow ID}
      - {name: api-version, in: query, required: true, type: string, default: '2016-11-01'}
definitions: {}
parameters: {}
responses: {}
securityDefinitions:
  oauth2_auth:
    type: oauth2
    flow: accessCode
    authorizationUrl: https://login.windows.net/common/oauth2/authorize
    tokenUrl: https://login.windows.net/common/oauth2/authorize
    scopes: {}
security:
- oauth2_auth: []
tags: []
 
  1. Before creating the custom connector using the above swagger file, you will need to register an application with the Azure Active Directory service. For a refresher, read the following article here: https://docs.microsoft.com/azure/active-directory/azuread-dev/v1-oauth2-on-behalf-of-flow#register-the-application-and-service-in-azure-ad.  While going through that process, grant permission for the flow service:  

Please make sure you are Adding the Activity.Read.All and Flows.Read.All permissions.

  1. Next steps is to Navigate to make.powerapps.com. In the left navigation bar traverse to Dataverse->Custom Connectors and create a new custom connector (Create from blank).

  2. Please provide the custom connector name and click on continue. You will be redirected to the below page.

  1. In the above image you will be seeing an option called Swagger editor. Please click on it, then it will redirect you to the below page.

  1. In the left side black screen, please copy and paste the swagger code which I have mentioned above. Once it is done, please click on update connector. It will navigate you to the security tab.

  2. Under Authentication type, you can see the option to edit. Then please enter Client Id, Client Secret and Resource URL: https://service.flow.microsoft.com/ and click on continue. It will navigate you to the definition tab.

  3. In the definition tab, you can see the GetFlowRunHistory Action as below. The request has the environment id, flow id, and api-version as input.

You can test this custom connector by passing the environment id, flow id and api version (by default value is 2016-11-01). After testing you can come outside of this custom connector and navigate to Power Automate and add this connector as a action. You will be see the below image inside your Power Automate.

Thanks for reading.

If you are interested in this topic and would like to do some further self-study, I encourage you to check out my blog on this.

Comments


1688905823827.jpg

Hi, I'm Dharani

I am a Principal Consultant at Capgemini Australia, specializing in Microsoft Business Applications. With a passion for knowledge sharing and community engagement, I hold the esteemed title of MVP in Business Applications and am a Microsoft Learn Expert.

  • Facebook
  • Twitter
  • LinkedIn
  • Instagram

Subscribe

Thanks for submitting!

bottom of page