web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How do you use a flow ...
Power Automate
Unanswered

How do you use a flow to change the owner of other flows

(0) ShareShare
ReportReport
Posted on by 19

Hello all,

 

We have 3 environments: DEV, TEST, and PROD.  For DEV we use service account SVCACC1 as the primary owner of the flows.  For both TEST and PROD we use SVCACC2 as the primary owner of the flows.

 

We do not distribute the credentials of these accounts (SVCACC1 & SVCACC2) to our developers.  Each developer has their own "admin" account that has enough privileges to import and export solutions from each environment. 

 

The challenge we are facing is that when the developers import a solution from the DEV environment into TEST or PROD their "admin account becomes the owner of the flow.  We have attempted to use the "Get Flow Owner Role as Admin" and "Edit Flow Owner Role as Admin" actions to change the ownership of the flows to SVCACC2 but all that happens is that SVCACC2 gets added as a co-owner of the flows.  We can, however, manually use the edit option to change the ownership but this is tedious as some of the projects have over 100 flows.

 

Does anyone know the correct way to change the primary owner of a flow using another flow?

 

Categories:
I have the same question (0)
  • SamLed Profile Picture
    2,338 Moderator on at

    Hi,

     

    Sorry, but your deployment process makes no sense. If you are using service accounts for these environments and the developers do not have the credentials, this means that the import should not be done by them but by someone with these credentials.

    You're looking for a tedious solution to a problem that wouldn't arise if you imported solutions directly with a service account.

    It would be preferable for developers to write a deployment procedure for an admin who would carry out the task.

    ______________________________________________________________

    If I have answered your question, please Accept the post as solution.
    If you like my response, please Thumbs Up.

  • Clasho Profile Picture
    19 on at

    Hi Sam,

     

    Thanks for your answer.  I agree with you that the deployment process is a bit wonky.  We have some internal roadblocks that we have to overcome before we can import the solutions using the service accounts.

     

    That being said...is what I am asking in the original post possible or not?

  • SamLed Profile Picture
    2,338 Moderator on at

    Hi Clasho,

     

    At first I thought it wasn't possible using flow, I thought about PowerShell, so I did a search in that direction and found this article: Change the original Owner of a Power App & Flow – Mohamed Ashiq Faleel

    ______________________________________________________________

    If I have answered your question, please Accept the post as solution.
    If you like my response, please Thumbs Up.

  • Clasho Profile Picture
    19 on at

    Hi SamLed,

     

    Thanks for the link to the article.

     

    After experimenting for some time I have come to the conclusion that the owner of flow cannot be changed by Powershell.  The PowerShell cmdlet that would change the attribute required is not allowed to set the required value:

     

    First I run the Get-AdminFlowOwnerRole

    Get-AdminFlowOwnerRole -FlowName ffffffff-ffff-ffff-ffff-ffffffffffff -EnvironmentName eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee

     I observe that the 2 accounts listed as owners in the PowerAutomate console are shown as the return values:

    RoleId : /providers/Microsoft.ProcessSimple/environments/eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee/flows/ffffffff-ffff-ffff-ffff-ffffffffffff/permissions/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
    RoleName : aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
    PrincipalObjectId : aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
    PrincipalType : User
    RoleType : CanEdit
    FlowName : ffffffff-ffff-ffff-ffff-ffffffffffff
    EnvironmentName : eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee
    Internal : @{name=aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa; id=/providers/Microsoft.ProcessSimple/environments/eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee/flows/ffffffff-ffff-ffff-ffff-ffffffffffff/permissions/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa;
     type=/providers/Microsoft.ProcessSimple/environments/flows/permissions; properties=}
    
    RoleId : /providers/Microsoft.ProcessSimple/environments/eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee/flows/ffffffff-ffff-ffff-ffff-ffffffffffff/permissions/bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb
    RoleName : bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb
     bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb
    PrincipalObjectId : bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb
    PrincipalType : User
    RoleType : Owner
    FlowName : ffffffff-ffff-ffff-ffff-ffffffffffff
    EnvironmentName : eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee
    Internal : @{name=bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb; id=/providers/Microsoft.ProcessSimple/environments/eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee/flows/ffffffff-ffff-ffff-ffff-ffffffffffff/permissions/bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb;
     type=/providers/Microsoft.ProcessSimple/environments/flows/permissions; properties=}

     The one that is listed as the owner in the PowerAutomate console has a RoleType of Owner in the PowerShell output as shown above.

     

    When I attempt to change the ownership to the other account using the command below:

    Set-AdminFlowOwnerRole -PrincipalType User -PrincipalObjectId aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa -RoleName Owner -FlowName ffffffff-ffff-ffff-ffff-ffffffffffff -EnvironmentName eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee

    I get this error:

    Set-AdminFlowOwnerRole : Cannot validate argument on parameter 'RoleName'. The argument "Owner" does not belong to the
    set "CanView,CanEdit" specified by the ValidateSet attribute. Supply an argument that is in the set and then try the
    command again.
    At line:1 char:110
    + ... ObjectId aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa -RoleName Owner -FlowNa ...
    + ~~~~~
     + CategoryInfo : InvalidData: (:) [Set-AdminFlowOwnerRole], ParameterBindingValidationException
     + FullyQualifiedErrorId : ParameterArgumentValidationError,Set-AdminFlowOwnerRole

     using either CanView or CanEdit does succeed but neither of the results in the subject account being assigned the RoleType of Owner

  • SamLed Profile Picture
    2,338 Moderator on at

    Hi,

     

    Owner is not a value accepted for this PowerShell commandlet. Reading more carefully article, I found this: You can also remove an Owner by the following command, the only catch is you will not be able to remove the creator of the flow.

     

    Consider giving a try using REST API call: Work with cloud flows using code - Power Automate | Microsoft Learn

     

    Source: How to change the original owner of a flow? - Power Platform Community (microsoft.com)

    ______________________________________________________________

    If I have answered your question, please Accept the post as solution.
    If you like my response, please Thumbs Up.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard