Using Admin powershell cmdlets with PowerPlatform

By | July 22, 2019

There is a bunch of useful admin cmdlets we can use with the PowerPlatform, but, as it turned out, they can be a little tricky.

As part of the CI/CD adventure, I wanted to start using those admin scripts to create/destroy environments on the fly, so here is what you may want to keep in mind.

Do make sure to keep the libraries up to date by installing updated modules

Install-Module -Name Microsoft.PowerApps.Administration.PowerShell -force
Install-Module -Name Microsoft.PowerApps.PowerShell -AllowClobber –force

EnvironmentName parameter means GUID, not the actual display name

For example, in order to remove an environment you might need to run a command like this:

Remove-AdminPowerAppEnvironment -EnvironmentName 69c2da9a-736b-4f09-9b5c-3163842f539b

You may not be able to change environment display name if there is a CDS database created for the environment

image

I believe this is because the additional “ID” you see in the name of such environments identifies environment url:

image

image

Sometimes it helps to see how your environment looks like from the PowerShell standpoint

You can run these two commands to get those details:

$env = Get-AdminPowerAppEnvironment “*prod”

$env

image

Finally, if you are receiving an error, adding –Verbose switch to the command may help

image

One thought on “Using Admin powershell cmdlets with PowerPlatform

  1. Greg

    Is it possible to pull the Storage capacity usage via. Powershell?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *