From time to time you would need to change owner of PowerApps created in your organization. There is currently no GUI (March 2020) – way for that so we will use PowerShell 🙂 (as always).
First thing we need is AppName (App ID), which we will find in Details
Next.
If you didn’t already, you have to install two PowerShell modules:
Install-Module -Name Microsoft.PowerApps.Administration.PowerShell
Install-Module -Name Microsoft.PowerApps.PowerShell -AllowClobber
Next.
Probably there are a few ways on how to connect to PowerApps from PowerShell, you can read more here, but in this case we will use:
Get-PowerApp
This will open login dialog where you will need to add your company email address and password.
After successful sign in, we can start with gathering more information. We will need “PrincipalObjectId” of our new owner, “EnvironmentName” and “App ID” from first step (i assume you shared app with users, and user who should be the new owner have access to this app – if not you have to share app with particular user).
To get that information we will use Get-PowerApp and Get-PowerAppRoleAssignment cmdlet:
Get-PowerApp -AppName <app id from first step> | Get-PowerAppRoleAssignment | Select PrincipalDisplayname, PrincipalObjectId, RoleType, AppName, EnvironmentName
So we have information we need, let’s change the owner with Set-AdminPowerAppOwner command:
Set-AdminPowerAppOwner -AppName <app id from first step> -AppOwner <PrincipalObjectId> -EnvironmentName <EnvironmentName>
That’s it. After that you can check if you see new owner, either in PowerShell or in PowerApps GUI.
Please check article on Microsoft website for more Cmdlets you can use.
Hope you will find this useful, if so let me know in the comment 🙂
3 comments
Jun
typo found
Get-PowerAppRoleAssigment -> Get-PowerAppRoleAssignment
Information was very helpful. Thank you.
PowerAddict
Thank you for feedback, typo corrected.
Jack
Thank you! That’s exactly what i needed today.