Sharing a Power App with a user gives the user the rights to run the Power App. Every user that runs the Power App for the first time, needs to allow some services (connectors) that the Power App connects with.
This can occur when the app is ran from a SharePoint page or directly from the Power Apps portal.
You might want to turn this consent prompt off by executing a PowerShell command.
What do you need?
- Power Apps module for Powershell
- A user with any of these roles, Global admins, Azure Active Directory Global admins, or Dynamics 365 admin, can access the Power Apps admin PowerShell cmdlets. This user needs to have logged in at least once into the Power Platform Admin Center, otherwise you’ll get an error.
Installing PowerApps module
The official documentation describes how you can install the module.
You need to execute following Powershell commands:
Install-Module -Name Microsoft.PowerApps.Administration.PowerShell
Install-Module -Name Microsoft.PowerApps.PowerShell -AllowClobber
Executing the most important command
First, you need to login with the admin account. A prompt will open to enter your e-mail and password. If MFA is activated, you’ll also need to fill in the MFA code.
Add-PowerAppsAccount
To turn off the consent prompt, you can execute the Set-AdminPowerAppApisToBypassConsent command. The app is required for this.
Go to https://make.powerapps.com/, select your app and open the details.
Copy the app ID.
Paste the app ID after “-AppName”:
Set-AdminPowerAppApisToBypassConsent -AppName [App ID here]
Execute the command to turn off the consent prompt.
If you get an error, your admin account doesn’t have enough permissions to execute the command.
This was helping !
I had to add a parameter to the command to make it work: guid of the environment
Set-AdminPowerAppApisToBypassConsent -AppName $app -EnvironmentName $env