I wanted to write about this for a while but never got around it. So here it is…

Background

Now-a-days we are building lots and lots of canvas apps for group of users. We create a security group and share the canvas app with that security group. We add users those security group which allows them to access the canvas apps. All good!! But, when users access these canvas apps they get this popup asking them to provide the consent to utilize the connectors that are used in the app. Now what if any of the user disallows this? They are unable to run the canvas apps. This prompt as shown in the below image is confusing and some times have even caused a concern in the mind of the user.

If you have created an enterprise-level application and what I mean by enterprise-level is; your app is going to be used by multiple users spread throughout your company then you might want to bypass the consent popup for each user – as the app should already be approved for usage at that level and you do not want additional consent.

Bypass Consent

The consent popup can be bypassed using a simple PowerShell Script. But we first need the App Id that will be used in the script. So to grab the App Id of the App for which you want to bypass the consent popup; you will have to head to make.powerapps.com; select your appropriate Environment and under Apps find your canvas app. Click on More Commands > Details as shown below:

Once you open the app’s detail page you can see the App Id – copy and store it as we will need it later.

Now that we have the App Id, we need to run the PowerShell Script that will enable bypassing the consent popup. You can find the script below:

Install-Module -Name Microsoft.PowerApps.Administration.PowerShell
Install-Module -Name Microsoft.PowerApps.PowerShell -AllowClobber
Set-AdminPowerAppApisToBypassConsent -AppName <Your App Id>

In order to execute the PowerShell script I normally use Windows PowerShell ISE application in ADMIN mode as shown below:

During the module installation process you might get some prompts; just click on Yes or Yes to All. Once all modules are installed; you should get a prompt for login as shown below; add your appropriate credentials (this script only runs for Admins):

Finally if the script successfully executed you should see Code: 200 message which states that the execution was successful; as shown below:

Verifying

Now, that you executed the script; but how do you make sure if it is working correctly. Easy, head over to Fetch XML Builder in XrmToolBox and fetch data from entity “canvasapps” with attributes such as name, displayname, bypassconsent like shown in the screenshot below:

As you can see our canvas app “Battle Royale” has Bypass Consent as TRUE. This proves that the script worked.

Hope this helps.

Don’t forget to subscribe to my Power Platform ProDev Newsletter

For more content subscribe to my blogs and follow me on:

Become one of my sponsors on GitHub

3 comments

  1. Hi Danish – just curious if there’s any reason why you couldn’t just use the Bulk Data Updater (or similar) in XrmToolbox to update the same field value rather than using PowerShell?

    Like

Leave a comment