End user receives pop-up asking for permission when launching PowerApps
I’m a big fan of working with PowerApps and creating business solutions using that tool. Until last week I wasn’t aware, that when I use specific permissions to access data sources (SharePoint in that case) inside my app, the end user who is going to use that app will be asked for permissions, to be able to use that application.
The message users were seeing was as following:
This situation is usually a “no go” from business owners, who are asking “why is this showing” and claiming, that when a regular, end user sees it, he is not going to click anything because of the confusion. Well, they are right.
I was looking the internet for some of the solutions, information, how to impersonate such connection or elevate permissions for it, so that user is not asked to grant them on his own. I found, that there is an idea already submitted: https://powerusers.microsoft.com/t5/PowerApps-Ideas/Delegate-to-Administrator-Allow-access-window-when-sharing/idi-p/98739 about allowing to make connections on behalf of a specific account. Cool, but that’s an idea only.
Then I found this topic: https://powerusers.microsoft.com/t5/General-Discussion/End-Users-receive-pop-up-asking-for-permission-when-launching/td-p/31906/ and the solution described using PowerShell Cmdlets for PowerApps (described here: https://docs.microsoft.com/en-us/powerapps/administrator/powerapps-powershell).
I tried them, and it works! Below a step by step, so that you can get rid of these popups forever.
PowerApps cmdlets installation
Important! From 2019-01-07 the cmdlets have been split into two groups: administrator and maker. To run any of the administrator cmdlet account must have PowerApps P2 license assigned.Source: https://powerapps.microsoft.com/en-us/blog/gdpr-admin-powershell-cmdlets/
Important! You have to have administration account on your machine and be a Global Administrator of your Office 365 tenant, to follow the installation and execution steps!
- Download the PowerShell Scripts file.
- Unzip the file into a folder.
- Open Windows PowerShell as an administrator.
- Set the location path of your PowerShell console to the folder, where you unzipped the scripts (using the “cd” command).
You need now to elevate/ change Execution Policy level of the scripts on your machine. Type the below in PowerShell window:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force
Next, as the Microsoft team is saying, that there is a known issue today that may also require to manually unblock the PowerShell, copy and paste the following command:
dir . | Unblock-File
Next, import necessary modules:
Import-Module .\Microsoft.PowerApps.Administration.PowerShell.psm1 -Force
Import-Module .\Microsoft.PowerApps.PowerShell.psm1 -Force
PowerApps cmdlets execution
This call will open a prompt to collect the credentials (AAD account & password) that will be used by the commands. Provide your Global Admin credentials. It is going to be valid for the next 8 hours:
Next open the details page of the PowerApps app you would like to “enhance” and copy its App ID:
Be sure, that the Global Admin account, if different to yours, also has “Co-owner” access to the app or is the “Owner” (and has PowerApps P2 license assigned). In case not, share the app with that account:
Now copy, replace “APP-ID” with yours and execute the following Cmdlet, to bypass requesting for permissions:
Set-AdminPowerAppApisToBypassConsent -AppName APP-ID -ApiVersion 2017-05-01
If all went fine, you should now see the “Code: 200” and “Description: OK”. Starting now, when your end users are going to open the app, they will not see that prompt for permissions again.
Disclaimer: before executing the Cmdlet I have republished the app using the Global Admin account. Haven’t checked if all would work without that. Nevertheless, once the Cmdlet was run, I have been developing the app with my regular account, published it several times and the prompt is not showing up anymore.