The world of PowerApps can be new and exciting, not to mention completely frustrating! A lot of my frustrations come from my lack of knowledge of the product but there are times when it’s not that, but an issue with the Office 365 platform itself.
This brings me to my issue I was having when embedding PowerApps onto an Office 365 modern SharePoint page. I had saved and published my form, and all seemed well. It displayed perfectly or me, all controls worked, etc. I had someone on my team test and suddenly, something was amiss.
My tester said that they were being asked for credentials. But why? Why would I ever need to provide my login information again after I have already logged in to 365? If you don’t know what I’m talking about or haven’t been fortunate yet to see this screen, this is what it will look like:

I thought that I did something wrong, so I began my favorite past time of searching the innerwebs to see if I was the only one or not. Luckily for me, I wasn’t. I came across the following community post stating the exact same issue I was having: https://powerusers.microsoft.com/t5/Administering-PowerApps/Embedding-PowerApp-into-Sharepoint-site/td-p/157116
This post mentions that if you receive the connection permission sign in pop up, that it is possible to bypass it by running the following PowerShell command bout having to run a PowerShell command:
Set-AdminPowerAppApisToBypassConsent
Now, don’t do what I did and run this command expecting everything to work all nice and stuff. There are a number of steps you need to follow before you can even run this command. That being said…….. Let’s do this!!!!
We will be using the SharePoint Online Management Shell to run this command but before we do, we will need to import the required Cmdlets for PowerShell. This blog post expands on all of the PowerShell cmdlets: https://powerapps.microsoft.com/en-us/blog/gdpr-admin-powershell-cmdlets/
After you download and extract the files, open the SharePoint Online Management Shell. Make sure that you ‘Run as Administrator’.
Next, navigate in PowerShell to the directory where you extracted the files and run the following script:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force
dir . | Unblock-File
Import-Module .\Microsoft.PowerApps.Administration.PowerShell.psm1 -Force
Import-Module .\Microsoft.PowerApps.PowerShell.psm1 -Force
Add-PowerAppsAccount
Sign in to your tenant using your admin account. ***Note: Your admin account must be using a role that is both the PowerApp publisher and an o365 Global Admin.
Once you have run the script and have signed in to your tenant, you are now ready to use this command:
Set-AdminPowerAppApisToBypassConsent -AppName xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
If you notice, there is a GUID used to identify the PowerApp. The easiest way to get the App ID (GUID) is to login to the PowerApps Admin Center. Once there, find the specific PowerApp that you are working with and click on it to see the details. At the bottom of the screen you should see the App ID. Copy the GUID next to that and place next to –AppName in your script.
You can also use this PowerShell command, Get-AdminPowerApp, but for me this is a slower process because I’m having to look through the many line items. I’ve always been more of a GUI type user, so really it’s just a preference.
Once run, you will see the following output on your screen:

That’s it! No more prompt!
Stay Salty!