Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / productivity / Office

How to Change the Owner of the PowerApp

0.00/5 (No votes)
3 Jul 2020CPOL1 min read 15.4K  
This tip explains how to change the owner of the PowerApp in Office 365
There is a very common scenario in the Admin world where you have to change the owner of the PowerApp. This mainly occurs when the creator or owner of the App is moved out of the organization. There is no way to edit the PowerApp if you are not the owner or co-owner of the App.

Introduction

PowerApps is the emerging no code solution provided by Microsoft in the Office 365 world. Users with no development background will be able to customize the SharePoint list using PowerApp or create a Canvas app without much effort to meet their business needs.

Background

The user who creates PowerApp will be the default owner of the app. The owner always has an option to set other users as owner of the app. But many times, owners don't set others as owners of their app. Since the PowerApp is associated to the user profile of the owner, PowerApps will be deleted automatically by the system once the owner moves out of the organization or his/her O365 ID gets disabled.

This is a very common challenging scenario in the Admin world to set different user(s) as the owner of the PowerApp. There is no way to edit the PowerApp if you are not the owner or co-owner of the App.

This post explains how to manage the situation .

Using the Code

First of all, you need to find out the PowerApp Name or ID. Follow the below steps:

C++
Install-Module -Name Microsoft.PowerApps.Administration.PowerShell
Install-Module -Name Microsoft.PowerApps.PowerShell -AllowClobber

#Set variable for your tenant ID 
$envname="Default-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";

#This is the user to connect to the environment. Make sure it has Admin rights.
$User = "test.user@test123.onmicrosoft.com"
$pass = ConvertTo-SecureString "xxxxxxxx" -AsPlainText -Force

#Connect to the environment
Add-PowerAppsAccount -Username $User -Password $pass

#Get the details of a particular App by name (TestApp-DEV is the name of the App)
$apps = Get-AdminPowerApp | Where-Object {$_.DisplayName -like 'TestApp-DEV'}

#This shows the App ID of the PowerApp
Write-Host $apps.AppName

Now get the  Id of the new owner, "test.user_2@test123.onmicrosoft.com", follow the below steps:

C++
Connect-AzureAD

$userId = Get-AzureADUser -ObjectId "test.user_2@test123.onmicrosoft.com"

Use the Set-AdminPowerAppOwner command to transfer the ownership of the PowerApp, try the below step.

C++
Set-AdminPowerAppOwner –AppName $apps.AppName -AppOwner $userId –EnvironmentName $envname

Now the owner of the $app is changes to new owner, you can verify it by using the below commands:

C++
#Get the details of a particular App by name (TestApp-DEV is the name of the App)
$apps = Get-AdminPowerApp | Where-Object {$_.DisplayName -like 'TestApp-DEV'}

Write-Host  $apps.Owner

Points of Interest

This will help admins to transfer the ownership of the PowerApps in their environments.

Reference

History

  • 22nd June, 2020: Initial version

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)