Get All Flows in Environment using Power Automate List Flows as Admin (V2 action

Power Automate: Get All Flows in Environment – List of All Flows In The Environment

No comments

Loading

In this “Get All Flows in Environment using Power Automate or List of All Flows In the Environment” article, we will learn how to retrieve all flows with their status, and other metadata or properties from a given Power Platform Environment.

Get All Flows in Environment using Power Automate

Before getting into the demo, let us understand a few concepts with respect to managing the flows automatically:

Why Automatic Flow Management is Vital for Large Power Platform Environments

In a big Power Platform environment, there are usually tons of flows or processes happening. It’s like having many moving parts in a giant machine, and keeping track of them all is tough. This is where automatic flow management comes in and becomes super important. It’s like having a helpful assistant who looks after all the flows for you. This assistant ensures they’re all working smoothly and none of the balls, or flows, are dropped. It’s a big relief for the boss, or the person in charge (the administrator). They can focus on other important things without worrying about the flows. Automatic flow management is like having a well-paved, smooth road to travel on, making work much easier and less stressful for everyone. To handle flow management, Microsoft has introduced Power Automate Management module in Power Automate tech stacks.

What is Power Automate Management module?

The Power Automate Management connector facilitates communication with the Power Automate Management service, allowing actions like flow creation, editing, and updates. When administrators need to execute operations with admin privileges, they should utilize actions suffixed with ‘as Admin.’

Using Power Automate Get All Flows from Power Platform Environment step by step

Let’s follow the below steps how we can get all flows from Power Platform Environment step by step.

Step1: Create a test manually trigger flow, then add a new action.

In the choose an operation, type “Management” text and hit enter.

Click on the “Power Automate Management” action.

Add Power Automate Management action in Power Automate

Add Power Automate Management action in Power AutomateStep2: Click on the “List Flows as Admin (V2)” action.

Power Automate Management - List Flows as Admin (V2)
Power Automate Management – List Flows as Admin (V2)

Step 3: Configure the authentication type.

Select Authentication Type as “First Party”, then click on the “Sign in” button.

Power Automate Management - Authentication Type as First Party
Power Automate Management – Authentication Type as First Party

Step 4: Complete the sign in process using your Microsoft account.

Power Automate Management - Login to Microsoft Account as a First Party Authentication Type
Power Automate Management – Login to Microsoft Account as a First Party Authentication Type

Step 5: Select your power platform environment from the list of available environments.

List Flows as Admin (V2) - Select your environment
List Flows as Admin (V2) – Select your environment

Step 6: Run the Flow – perform the test run.

List Flows as Admin (V2) - Response or Output

List Flows as Admin (V2) – Response or Output

Copy and paste the JSON outputs into a notepad for your reference. The purpose of this is that you can see what properties are returned by this action “List Flows as Admin (V2)”.

[

  {

    "name": "b02ce430-209d-4f25-9ba0-b9fa058909f3",

    "id": "/providers/Microsoft.Flow/environments/Default-f10e1e03-fffa-47d0-86f4-d0e3c317c65d/flows/b02ce430-209d-4f25-9ba0-b9fa058909f3",

    "type": "Microsoft.Flow/environments/flows",

    "properties": {

      "apiId": "/providers/Microsoft.PowerApps/apis/shared_logicflows",

      "displayName": "Create list in SharePoint Online Using Power Automate",

      "state": "Started",

      "createdTime": "2023-08-25T15:59:11Z",

      "lastModifiedTime": "2023-09-07T03:49:44Z",

      "flowSuspensionReason": "None",

      "environment": {

        "name": "Default-f10e1e03-fffa-47d0-86f4-d0e3c317c65d",

        "type": "Microsoft.Flow/environments",

        "id": "/providers/Microsoft.Flow/environments/Default-f10e1e03-fffa-47d0-86f4-d0e3c317c65d"

      },

      "definitionSummary": {

        "triggers": [],

        "actions": []

      },

      "creator": {

        "tenantId": "f10e1e03-fffa-47d0-86f4-d0e3c317c65d",

        "objectId": "2e091943-815b-4b48-a9fe-fa7edc4c3d86",

        "userId": "2e091943-815b-4b48-a9fe-fa7edc4c3d86",

        "userType": "ActiveDirectory"

      },

      "flowFailureAlertSubscribed": false,

      "isManaged": false,

      "machineDescriptionData": {}

    }

  },

  {

    "name": "f0911a16-52c2-4b4a-9880-050cddf111a5",

    "id": "/providers/Microsoft.Flow/environments/Default-f10e1e03-fffa-47d0-86f4-d0e3c317c65d/flows/f0911a16-52c2-4b4a-9880-050cddf111a5",

    "type": "Microsoft.Flow/environments/flows",

    "properties": {

      "apiId": "/providers/Microsoft.PowerApps/apis/shared_logicflows",

      "displayName": "How to Unzip a File using Power Automate",

      "state": "Started",

      "createdTime": "2023-08-19T13:03:27Z",

      "lastModifiedTime": "2023-08-19T14:50:32Z",

      "flowSuspensionReason": "None",

      "environment": {

        "name": "Default-f10e1e03-fffa-47d0-86f4-d0e3c317c65d",

        "type": "Microsoft.Flow/environments",

        "id": "/providers/Microsoft.Flow/environments/Default-f10e1e03-fffa-47d0-86f4-d0e3c317c65d"

      },

      "definitionSummary": {

        "triggers": [],

        "actions": []

      },

      "creator": {

        "tenantId": "f10e1e03-fffa-47d0-86f4-d0e3c317c65d",

        "objectId": "2e091943-815b-4b48-a9fe-fa7edc4c3d86",

        "userId": "2e091943-815b-4b48-a9fe-fa7edc4c3d86",

        "userType": "ActiveDirectory"

      },

      "flowFailureAlertSubscribed": false,

      "isManaged": false,

      "machineDescriptionData": {}

    }

  },

  {

    "name": "fb5f4f91-491d-4d73-bbec-d8a05278bc8b",

    "id": "/providers/Microsoft.Flow/environments/Default-f10e1e03-fffa-47d0-86f4-d0e3c317c65d/flows/fb5f4f91-491d-4d73-bbec-d8a05278bc8b",

    "type": "Microsoft.Flow/environments/flows",

    "properties": {

      "apiId": "/providers/Microsoft.PowerApps/apis/shared_logicflows",

      "displayName": "Get All Flows From a Power Platform Environment",

      "state": "Started",

      "createdTime": "2023-09-30T13:50:50Z",

      "lastModifiedTime": "2023-09-30T13:50:50Z",

      "flowSuspensionReason": "None",

      "environment": {

        "name": "Default-f10e1e03-fffa-47d0-86f4-d0e3c317c65d",

        "type": "Microsoft.Flow/environments",

        "id": "/providers/Microsoft.Flow/environments/Default-f10e1e03-fffa-47d0-86f4-d0e3c317c65d"

      },

      "definitionSummary": {

        "triggers": [],

        "actions": []

      },

      "creator": {

        "tenantId": "f10e1e03-fffa-47d0-86f4-d0e3c317c65d",

        "objectId": "2e091943-815b-4b48-a9fe-fa7edc4c3d86",

        "userId": "2e091943-815b-4b48-a9fe-fa7edc4c3d86",

        "userType": "ActiveDirectory"

      },

      "flowFailureAlertSubscribed": false,

      "isManaged": false,

      "machineDescriptionData": {}

    }

  },

  {

    "name": "fb7b3245-030b-4d68-a5f7-f53e55b43416",

    "id": "/providers/Microsoft.Flow/environments/Default-f10e1e03-fffa-47d0-86f4-d0e3c317c65d/flows/fb7b3245-030b-4d68-a5f7-f53e55b43416",

    "type": "Microsoft.Flow/environments/flows",

    "properties": {

      "apiId": "/providers/Microsoft.PowerApps/apis/shared_logicflows",

      "displayName": "Create Zip File Using Power Automate Flow",

      "state": "Started",

      "createdTime": "2023-08-10T14:32:24Z",

      "lastModifiedTime": "2023-08-19T13:01:02Z",

      "flowSuspensionReason": "None",

      "environment": {

        "name": "Default-f10e1e03-fffa-47d0-86f4-d0e3c317c65d",

        "type": "Microsoft.Flow/environments",

        "id": "/providers/Microsoft.Flow/environments/Default-f10e1e03-fffa-47d0-86f4-d0e3c317c65d"

      },

      "definitionSummary": {

        "triggers": [],

        "actions": []

      },

      "creator": {

        "tenantId": "f10e1e03-fffa-47d0-86f4-d0e3c317c65d",

        "objectId": "2e091943-815b-4b48-a9fe-fa7edc4c3d86",

        "userId": "2e091943-815b-4b48-a9fe-fa7edc4c3d86",

        "userType": "ActiveDirectory"

      },

      "flowFailureAlertSubscribed": false,

      "isManaged": false,

      "machineDescriptionData": {}

    }

  }

]

 

Additionally, you can add a compose action to see the total number of flows returned by this action “List Flows as Admin (V2)”, You can use the below function for this.

Total Flows Count:

length(outputs('List_Flows_as_Admin_(V2)')?['body/value'])

 

List Flows as Admin (V2) - Total Flows Count
List Flows as Admin (V2) – Total Flows Count

Step 7: Add a Create HTML table data operation compose action.

In the “From,” select a value from the List Flows as Admin (V2) action from the dynamic content section, or you can copy and paste the below text:

@{outputs('List_Flows_as_Admin_(V2)')?['body/value']}

List Flows as Admin (V2) - Create HTML Table in Power Automate

List Flows as Admin (V2) – Create HTML Table in Power Automate

In the “columns” selection, select “custom.” By default, automatic will be selected.

List Flows as Admin (V2) - Create HTML Table in Power Automate configuration
List Flows as Admin (V2) – Create HTML Table in Power Automate configuration

Add the below headers and their values:

  • FlowName: Select Flow Display Name from Dynamic Content List Flows as Admin (V2)
  • FlowState: Select Flow State from Dynamic Content List Flows as Admin (V2).
  • FlowCreated: Select Flow Created Time from Dynamic Content List Flows as Admin (V2)
  • FlowLastModified: Select Flow Modified Time from Dynamic Content List Flows as Admin (V2)

Note:

  • Here we have added three flow properties for this demo; however, you can add as many as you want by referring to the List Flows as Admin (V2) response output JSON.
  • If we select column type as automatic, we don’t configure the columns manually; the automatically constructed table will be constructed with the outcome of the List Flows as Admin (V2) response output JSON.

To get the number of actions from each flow, we can use the below function; however, it doesn’t give a count in the recent version of List Flows as Admin (V2); in the earlier version, i.e., without V2, it was supported. Microsoft has deprecated this “List Flows as Admin” action (June 2023) and introduced the V2 version.

However, if you are still using the “List Flows as Admin” action, you can use the below function to get the total action from each flow:

length(item()?['properties/definitionSummary/actions'])

Step 8: Send email to Admin

Add an “Send an email (V2)” action and configure the “To”, “Subject” and “Body” parameters.

In the body section, you just select the output from the previous action “Create HTML Table”.

List Flows as Admin (V2) - Send flow report as an email
List Flows as Admin (V2) – Send flow report as an email

Once we run the flow, we can see that an email has arrived to admin with the flow information.

List Flows as Admin (V2) - Send flow report as an email - Demo
List Flows as Admin (V2) – Send flow report as an email – Demo

Note:

Advantages of “List Flows as Admin (V2)” Power Automate Management

Following are the advantages of “List Flows as Admin (V2)” Power Automate Management:

  • Easy flow management where admins can work on some other priority stuff.
  • Take a second look at the flow containing the highest number of actions and work on optimizing them.
  • Revisit the most frequently used flow and apply the optimization approach mentioned earlier.
  • Transfer ownership of the flow to other users or service accounts. When multiple accounts manage flows, it enhances capacity utilization and mitigates potential bottlenecks caused by a single account handling all the flows. Here, we can have common dedicated service accounts for all connection references and flow owners.
  • Eliminate unnecessary actions, such as compose and duplicate actions, from the flows.

Summary: Get All Flows in Environment using Power Automate

Thus, in this article, we have learned about how to get all flows from a Power Platform environment using the Power Automate “List Flows as Admin (V2)” action, which will streamline and ease the flow management process automatically, especially when you have a bigger environment with many flows.

In this insightful post, we explored the essential process of accessing all flows within a specific environment using Power Automate. The focus was on efficient flow management, advocating for a streamlined approach to handling numerous workflows in a Power Platform environment.

The article outlined best practices, including optimizing actions within flows, removing unnecessary actions, and leveraging expressions and functions for improved efficiency. Additionally, it emphasized revisiting frequently utilized flows to ensure they align with the optimization strategy. Lastly, the post highlighted the significance of distributing flow ownership across various users or service accounts, enhancing capacity and operational effectiveness within the Power Platform environment.

See Also: Other Power Platform Articles

You may also like the following Power Platform articles:

 

About Post Author

Do you have a better solution or question on this topic? Please leave a comment