10 Useful Power Apps PowerShell Cmdlets
Power Apps Powershell cmdlets give administrators access to a hidden group of commands that cannot be executed through the Power Platform admin center. Often times, these Powershell cmdlets get promoted into the user interface of Power Platform. It provides Microsoft a quick way to roll out new features quickly to admins and get feedback. In this article, I will share the Power Apps PowerShell cmdlets I have found to be the most helpful.
Table of Contents
• Disable Power Apps Feedback Surveys
• Pin Hero & Featured Apps To The Top Of Power Apps Mobile
• Bypass The User Consent Dialog In Power Apps Canvas Apps
• Recover A Deleted Power Apps Canvas App
• Change The Owner Of A Power Apps Canvas App
• Set The SharePoint Custom Forms Environment
• Block Users From Requesting A Trial License
• Generate A Power Apps Per App License Usage Report
• Deactivate The Share Power Apps With Everyone Feature
• Associate A Flow To An Application To Reduce Licensing Costs
Disable Power Apps Feedback Surveys
The feedback pop-up is a feature you’ll want to turn-off for all of your Power Apps. It interrupts app users at random times to ask what they think of the app. This is an unwanted and confusing dialog.
Stop the Power Apps feedback survey from appearing by using this PowerShell code.
$updateSettings = @{disableSurveyFeedback = $false}
Set-TenantSettings $updateSettings
Pin Hero & Featured Apps To The Top Of Power Apps Mobile
Power Apps can be featured to make them more discoverable by users in the mobile app. This can only be done with the help of PowerShell commands.
Run this PowerShell code to add a new featured app.
$AppName '9a6d22d6-79a2-4d32-8abd-747a1d8ebcb0'
Set-AdminPowerAppAsFeatured –AppName $AppName
Once an app is featured you can also make it a Hero app. A Hero app appears at the top of the home screen. There can be only one Hero app per tenant.
Execute this PowerShell cmdlet to set the Hero app in Power Apps mobile.
$AppName '9a6d22d6-79a2-4d32-8abd-747a1d8ebcb0'
Set-AdminPowerAppAsHero $AppName
Bypass The User Consent Dialog In Power Apps Canvas Apps
When a user opens an app for the first time Power Apps asks permission to access other online services with their account. Informing the user and asking for consent is a good idea in theory. But most users don’t understand what they are approving and become confused by it.
This Power Shell cmdlet will remove the consent form for a specific app. There is no cmdlet to remove it for all apps in an environment.
$AppName '9a6d22d6-79a2-4d32-8abd-747a1d8ebcb0'
$EnvironmentName = 'Default-f1b8b509-50a4-4a5c-8e48-bf3d3e7c10ed'
Set-AdminPowerAppApisToBypassConsent -EnvironmentName $EnvironmentName -AppName $AppName
Recover A Deleted Power Apps Canvas App
Oops. Did you accidentally delete a canvas app? No worries, we can restore a Power Apps canvas app using PowerShell if its within 7 days of deletion.
First, use this PowerShell cmdlet to get the list of deleted apps for an environment and their unique identifiers.
$EnvironmentName = 'Default-f1b8b509-50a4-4a5c-8e48-bf3d3e7c10ed'
Get-AdminDeletedPowerAppsList -EnvironmentName $EnvironmentName
Then use the unique identifier with this PowerShell cmdlet to recover the app.
$AppName 5db4899d-29e5-446e-bf73-48163780e521
$EnvironmentName = 'Default-f1b8b509-50a4-4a5c-8e48-bf3d3e7c10ed'
Get-AdminRecoverDeletedPowerApp -AppName $AppName -EnvironmentName $EnvironmentName
Change The Owner Of A Power Apps Canvas App
When an app owner leaves the organization their Power Apps should be transferred to someone else who still works at the company.
Use this PowerShell cmdlet to change the app owner.
$EnvironmentName = 'Default-f1b8b509-50a4-4a5c-8e48-bf3d3e7c10ed'
$AppName = '3b328263-ef5e-4db8-b360-d74eb474b8af'
$NewAppOwner = '6857d910-10c3-485e-a492-6456ce2f1625'
Set-AdminPowerAppOwner –AppName $AppName -AppOwner $NewAppOwner –EnvironmentName $EnvironmentName
Set The SharePoint Custom Forms Environment
Power Apps custom SharePoint List forms live in the default environment. This is not ideal since there is no way to restore the default environment from a backup if something goes wrong.
Execute this PowerShell cmdlet to change where SharePoint custom forms are published. The target environment must be a production type environment. Existing SharePoint custom forms will not be moved as a result of this code.
$EnvironmentName = '2f8a1d5d-7c34-40bd-901e-54693fdc94bd'
Set-AdminPowerAppSharepointFormEnvironment –EnvironmentName $EnvironmentName
Block Users From Requesting A Trial License
Allowing users to request a trial license unblocks them from using an app immediately. But if your company is going to have any long-term success with administering Power Apps then users should request licenses the right way through the I/T department.
Run this PowerShell code to remove the ability of users to procure their own trial licenses while keeping this ability for admins. You will also have to turn off the AllowAdHocSubscriptions setting in Azure AD. This change cannot be undone so make sure you really want to do it. If at a later time you want to allow user trial license requests again it can be re-enabled.
Remove-AllowedConsentPlans -Types "Internal"
Generate A Power Apps Per App License Usage Report
Power Apps admin center does not have any reporting on who is using a per app license for which apps. Fortunately Powershell can be used to create a csv with all of the per app licenses for Power Apps and Power Automate in one file.
Write this PowerShell code to get a list of all the Power Apps & Power Automate per licenses in use for a tenant.
Get-AdminPowerAppLicenses -OutputFilePath '<licenses.csv>'
Deactivate The Share Power Apps With Everyone Feature
Sharing an app with everyone in a tenant might not be desirable for two reasons. First, an app shared across the organization by mistake can pose a security threat/data link. Secondly, licensing might not be in place for everyone who the app is being shared with.
To disable sharing an app with everyone in the tenant use this PowerShell code.
$updateSettings = Get-TenantSettings
$updateSettings.powerPlatform.powerApps.disableShareWithEveryone = $True
Set-TenantSettings -RequestBody $updateSettings
Associate A Flow To An Application To Reduce Licensing Costs
Scheduled and automated flows can be associated to an app. This is useful for premium apps & flows. A flow associated to an app can be run by a licensed user at no additional cost. The screenshot below is a pre-release image from the official Microsoft documentation. There is currently no way to do it without PowerShell.
Use this PowerShell code to associate an flow to an app. Please note, associating an app with a flow should only be done if they belong together as a part of the same solution. Associating a flow to an app solely for circumventing premium licensing costs is prohibited by Microsoft.
$EnvironmentName = 'Default-f1b8b509-50a4-4a5c-8e48-bf3d3e7c10ed'
$FlowName = 'f40c8ade-22fa-4f00-873a-11bf9fe46af5'
$AppName = '3b328263-ef5e-4db8-b360-d74eb474b8af'
Add-AdminFlowPowerAppContext -EnvironmentName $EnvironmentName -FlowName $FlowName -AppName $AppName
Did You Enjoy This Article? 😺
Subscribe to get new Power Apps articles sent to your inbox each week for FREE
Questions?
If you have any questions or feedback about 10 Useful Power Apps PowerShell Cmdlets please leave a message in the comments section below. You can post using your email address and are not required to create an account to join the discussion.
Great stuff Matthew!!
I think it would be helpful for absolute beginners if you add “Get Started with Powershell” on the top.
https://learn.microsoft.com/en-us/power-platform/admin/powerapps-powershell#get-started-with-powershell
Hi,
I’ve tried out the “Get-AdminPowerAppLicenses”, mainly to find the “Per App” allocation in my org.
But I do not get which type of License is the “Per App” license type?
I only see “Per User”, E3, E5, F3, etc.
One user, for example, which I know utilizes a “Per App” license has “Microsoft 365 E3”, “Microsoft Flow Free”, “Flow Free”, “Office 365 Enterprise E3”, “Microsoft 365 E3”, “Office 365 Enterprise E3” and comes up with License Assigned Date a few years ago.
Is the “Office 365 Enterprise E3” the Per License type?
Thanks.
Vktr,
Here’s the documentation page. Unfortunately, I cannot say since the documentation does not offer it.
https://learn.microsoft.com/en-us/powershell/module/microsoft.powerapps.administration.powershell/get-adminpowerapplicenses?view=pa-ps-latest
Good day Matthew. Re: Set The SharePoint Custom Forms Environment. Since this would be a new environment, how would you suggest managing security for it. Typically when I create a new environment, I add users via Entra AD or M365 groups. How do you recommend adding everyone in the company and applying security roles?
Also, do you have a specific DLP policy that you recommend? I would guess it would only need limited number of connectors.
After changing the environment for the SP forms, is there a way to migrate the exsiting forms?