Ever find that administering the Power Platform can involve some rather tedious and lengthy tasks such as navigating through a huge admin center to find that little thing you need…? Even… if you might know where it is?! Well, say goodbye to the days of a million GUI clicks to get to what you need. In this blog post, I’m going to give you 5 commands you can use with the Power Platform CLI as part of pac admin to administer the Power Platform at an accelerated pace! 🚀
pac admin list
So the first command that we’ll look at is really simple and comes with no required parameters that we have to supply values for! This is the pac admin list command which will return a list of all the environments in our tenant for us to quickly glace over, or utilise in a way that we see fit!
Once I’ve authenticated in the Power Platform CLI using pac auth create, I can simply run the command pac admin list and the list of environments will be returned.
Check it out…
pac admin status
This next command will show us any asynchronous operations currently running in our environment. If you don’t have any running you’ll get a message that alerts you of this, otherwise, the list of them will be displayed!
pac admin copy
Need to make a copy of an environment? Check out this command which lets you do just that! Using the pac admin copy command you’re able to copy an environment from a source to a target, with the option to just copy across customisations and schemas, or to copy the entire environment including all of its data in Dataverse.
To make a minimal copy of an environment which will only copy customisations and schemas use the following PowerShell…
pac admin copy `
--name "Environment Name" `
--source-env 00000000-0000-0000-0000-000000000000 `
--target-env 00000000-0000-0000-0000-000000000000 `
--type MinimalCopy
And then if you’d like to also include data simply change the value of the type parameter to FullCopy
pac admin copy `
--name "Environment Name" `
--source-env 00000000-0000-0000-0000-000000000000 `
--target-env 00000000-0000-0000-0000-000000000000 `
--type FullCopy
pac admin list-backups
Made a mistake and need to go back on something where an environment backup is gonna come in handy? Have a bunch of these that you need to get to and review quickly? Simply use the pac admin list-backups command to list all of the backups for an environment.
You will need to provide a value for the following parameter which allows you to specify the environment you want to return backups for.
–environment
Specify either the environment ID or URL as the value for the parameter above.
pac admin restore
Following on from listing backups, if you’d like to actually restore an environment to a backup that you spotted in the list returned, you can use pac admin restore to do this!
To restore the latest backup returned simply use the following command…
pac admin restore --selected-backup latest --source-env environmentID
This will apply the latest backup of the environment specified in the source env parameter to the environment that is currently selected / focused on in the active auth profile. Use the –target-env parameter if you’d like to specify an alternative environment to restore to.
If you’d like to specify another backup to restore from than the latest populate the –selected-backup parameter with a timestamp such as ’07/04/2023 ’10:00′
Upcoming Content
There you go! There’s 5 ways to use pac admin amongst many more in the Power Platform CLI! This blog post is part of a new wider series on getting to grips with the Power Platform Developer Tools covering all sorts from the Power Platform CLI to the Dataverse Developer Tools and the ALM Developer Tools.
Make sure you’re subscribed to my blog to get my latest content directly in your inbox! You don’t want to miss what’s coming! 💌
Subscribe