Prevent orphan flows by automatically assigning admin account as co-owner

Imagine a scenario where you have to make changes to a personal cloud flow that was not shared with anyone. If the user who created the flow leaves the organization, no one would be able to see the flow unless they go to flow admin section and look for the orphan flow.

Once you find the orphan flow, you can use “share” option and add a co-owner to that flow.

Power Platform admin center > Select Environment > Resources > Flow
Flow Admin Section

If you need a proactive solution for this, you can automatically add co-owners to new flows using Power Automate for Admins connector.

When there is a new personal flow created in the tenant, it will automatically add specified users as co-owners of that flow.

Below are the steps:

  1. Trigger – Scheduled ( could be a daily job)

2. List all flows in the tenant as admin

List Flows as Admin

Note : Make sure that you turn the pagination on and page size appropriately to get all the records. Otherwise, this will only give you the first 5 flow records.

Turn on pagination settings

3. Define timeframe to filter the newly created flows. If you are running this job daily, you need to set the interval as 1 day to capture all new flows that were created since last run.

Add Get Past Time action and you can use the base time as utcNow()

4. Now we need to check if the flow created time was after the Past Time and then add service account as co-owner.

Let’s add a condition that validates above logic

Once you add the “Flow Created Time” to the condition, it will go inside a loop that will repeat for all flow records.

5. If the result is yes (flow was created after the last run), assign service admin as the co-owner

Action : Modify Flow Owners as Admin

Environment : <Specify the environment>

Flow : <Flow Name>

User Object ID : <User or group object ID from Azure Active Directory>

User Type: <User/Group>

6. Add Terminate action as the final step

7. Save and test the flow.

You can modify the conditions to only add co-owner for specific user created flows, or if the title contains a certain identifier, etc.

Note that this flow cannot be used for solution aware(created within a solution) flows. You will need to open the solution and then update owners.

Happy Learning!



Categories: Power Automate

1 reply

Trackbacks

  1. Prevent orphan flows by automatically assigning admin account as co-owner - 365 Community

Leave a comment