Custom connector to get flow run history

Posted by

I’ve created a custom connector to get the run history of a specified flow in a specified environment.

Please follow the instructions from the Power Apps blog post for the app registration. Add the Activity.Read.All and Flows.Read.All permissions instead.

Download and import the swagger file for the custom connector.  Enter Client Id, Client Secret and Resource URL: https://service.flow.microsoft.com/. There’s one action, Get Flow Runs.

The request has the environment id, flow id, and api-version as input.

Test operation is successful with the following result.

Now I’m able to use this action of the custom connector to get the flow run history and process the data.

24 comments

  1. Does this work for Flows where you are not the owner? I am trying to get a list of Flow Run History for all Flows in the environment and this connector works for my own Flows but I get 403 back if I try other people’s Flows.

  2. Hi, Is this custom connector still works ?

    When I tried to test api call it is giving me the error as
    {
    “error”: {
    “code”: “ClientScopeAuthorizationFailed”,
    “message”: “The x-ms-client-scope header must not be null or empty.”
    }
    }

  3. Hi Stefan,
    I’m trying to create your request from postman. But I don’t know how to authenticate. I’m receiving error message like below. I’m trying to find information from another articles but still I’m on same place.

    Please, can you help me?

    AADSTS700016: Application with identifier ‘XXXXXXXXXXXXXX’ was not found in the directory ‘XXXXXXXXXXXXXX’. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You may have sent your authentication request to the wrong tenant.

  4. Hi Stefan,
    At the moment this connector always retreives the last 50 runs of a flow. Is it also possible to get all runs after a certain time stamp or a you always limited to these 50 runs?

    1. Hi Stefan,
      Great article, I have managed to make it work, but I have the same problem as Philip – I cannot get ALL the runs, but only 40 of them.
      Is there a way to get all the runs in the past 28 days?

  5. Hello,
    are those endpoint documented somewhere? How do you know this URL to list runs? I would like to check all possibilities but looks like there is no documentation…

  6. Unable to fetch the Flow run details outside of solution Flows always getting permission denied error. Is there any way to get the run information of Flows outside solution.

  7. Hello,

    I am trying to create this connector but I get the error AADSTS900561: The endpoint only accepts POST requests. Received a GET request.

    Is it true that :

    “You must have a license for Dataverse or Dynamics 365 Customer Engagement and a valid security role granting create access for connectors.”

    And only then I could be able to add the connector.

    If anyone knows how to work around it please let me know.

  8. What would be the redirect URL in the Azure App Registration?
    I am getting the below error:
    AADSTS50011: The redirect URI ‘blob:///oauth2-redirect.html’ specified in the request does not match the redirect URIs configured for the application ‘xxxxx-xx-xx-xx’. Make sure the redirect URI sent in the request matches one added to your application in the Azure portal. Navigate to https://aka.ms/redirectUriMismatchError to learn more about how to fix this.

  9. I have created the custom connector and it is working correctly, but only for a short period of time, when a couple of hours have passed and I run it again, it gives me an error ExpiredAuthenticationToken.

    How can I prevent the authentication token from expiring? Now, when you create a Custom Connector, in Security Tab when select AAD as Identity Provieder there is a new option called: Enable Service Principal support but I don’t care if I check this option or not, the token is expiring.

  10. This post was published in 2020. We are now in 2024. Is there a connector, action provided by Microsoft so far to achieve it?

  11. Flow Run table ( in dataverse Flow Run table data is not getting updated immediately once the flow executed) looks there is 2 to 4 hours delay.

    1. Hi Raghava,
      According to the documentation the cloud flow run history might take up to an hour to be available in Dataverse and the automation center. Or longer, in your experience 😉

Leave a Reply

Your email address will not be published. Required fields are marked *