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'}
basePath: /
schemes: [https]
consumes: []
produces: []
          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
      - {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: {}
    type: oauth2
    flow: accessCode
    scopes: {}
- oauth2_auth: []
tags: []

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

  • Next steps is to Navigate to In the left navigation bar traverse to Dataverse->Custom Connectors and create a new custom connector (Create from blank).
  • Please provide the custom connector name and click on continue. You will be redirected to the below page.
  • 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.
  • 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.
  • Under Authentication type, you can see the option to edit. Then please enter Client Id, Client Secret and Resource URL: and click on continue. It will navigate you to the definition tab.
  • 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.

2 thoughts on “How to create custom connector to get the flow run history

  1. Hi Dharanidharan,

    Thank you so much for your post. I helped me a lot!

    I need your help because I have a problem. When I try to create and read flow history from the default environment I didn’t had problems. But when I try to read the flow history from an environment the api returns this error:

    “error”: {
    “code”: “EnvironmentAccessDenied”,
    “message”: “You are not permitted to make flows in this ‘{{EnvironmentName}}’. Please switch to the default environment, or to one of your own environment(s), where you have maker permissions.”

    I am System Administrator and I try to assign environment maker role but i can’t. Can you recommend me any solution?

    Thank you so much


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s