Forum Discussion

luvsql's avatar
luvsql
Steel Contributor
Feb 01, 2022

Powershell script for Power Apps not working

I'm trying to run a PS script I found online which is supposed to disable the permission prompts for a specific power app but it's not really working.  

 

1.  Install-Module -Name Microsoft.PowerApps.Administration.PowerShell -RequiredVersion 2.0.127

 

Installs fine then grab the App ID of my power app:

 

2.  Set-AdminPowerAppApisToBypassConsent -AppName <my App ID>

 

But instead of it updating that setting, I'm getting this and don't know what I'm supposed to put in the "Environment Name."  It also didn't prompt me for my credentials.  

 

WARNING: The names of some imported commands from the module 'Microsoft.PowerApps.AuthModule' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose pa rameter. For a list of approved verbs, type Get-Verb. cmdlet Set-AdminPowerAppApisToBypassConsent at command pipeline position 1 Supply values for the following parameters: EnvironmentName:

 

  • You need to connect first, by running a cmdlet such as Get-AdminPowerAppEnvironment (it should prompt for credentials). You can then use Select-CurrentEnvironment to switch to the correct environment, if you have more than one. And run the Set-AdminPowerAppApisToBypassConsent cmdlet.
    • luvsql's avatar
      luvsql
      Steel Contributor

      VasilMichev I was able to get the existing PS to run:

       

      Set-AdminPowerAppApisToBypassConsent -AppName 0<appID>

       

      Once it's run, head into Power Apps and open one of the apps.  Copy the Default-and all the letters up until before /apps and paste that as the EnvironmentName.  It will then prompt for login and authentication then sets the value

       

Resources