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