Create Dataverse environments with the Power Platform CLI

8th July 2023

When working with low code and platforms such as Microsoft’s Power Platform, the idea of containerisation isn’t something not considered, and is rather something very much present, similar to the pro code world!

Creating environments in the Power Platform admin center can become tedious if you’re working in a larger organisation where this is a more common exercise, or where administering environments is a regular task. In this post, we’ll look at a super speedy way to create environments using the Power Platform CLI opening scope for much faster action execution!

Power Platform CLI 👨🏻‍💻

So… we’re starting to work with CLI (command line interface) huh… 🧐

Yes! We are ✅… so, if you didn’t check out my blog post from yesterday or you haven’t worked with the Power Platform CLI before, check out how you can get it installed on your machine below using the Power Platform Tools extension in Visual Studio Code.

Authenticating with CLI 🔐

Before we’re able to make commands and execute operations against our tenant or environments, we’ll need to work on authenticating against CLI with a persona/user that will also pass authorisation for the things we want to do.

In this post, we’re making admin commands, and creating environments so, we’ll need to authenticate with a persona or ‘user’ that has Power Platform Admin privileges.

To authenticate in the CLI, we will use the following command to begin with.

pac auth create

You’ll then be redirected to your default browser to login via the Microsoft login screen.

Here you’ll need to sign in with the account you have which has admin privileges assigned to it.

Once you’ve done that you’ll see a message in the terminal confirming if authentication was successful.

From here, if things worked, we can start to make some commands to interact with our tenant and execute some operations!

Creating an environment

To create an environment we will use the following command…

pac admin create

This is the command we will use, but there’s a number of arguments we need to provide inputs for after the command on the same line, that are equivalents as such to the inputs we’d have to populate in the admin center UI when creating an environment.

The arguments include…

–nameSets the name of the environment.-n
–regionSets the environment’s region name.-r
–typeSets the environment Type.

Values: Trial, Sandbox, Production, Developer, Teams, SubscriptionBasedTrial
–currencySets the currency used for your environment. [defaults to USD]-c
–languageSets the language used for your environment. [defaults to English]-l
–templatesSets Dynamics365 app that needs to be deployed. [passed as comma separated values] e.g : -tm “D365_Sample, D365_Sales”-tm
–domainThe domain name is part of the environment URL. If domain name is already in use, a numeric value will be appended to the domain name. Eg: If ‘contoso’ is already in use, then the environment URL will be updated to https://{contoso}
–input-fileThe verb arguments to be passed in a .json input file. Eg: {“name” : “contoso”}. The arguments passed through command-line will take precedence over arguments from the .json input file. -if
–asyncOptional boolean argument to run pac verbs asynchronously, defaults to false.-a
–team-idTeam Id as Guid-tid
–max-async-wait-timeMax asynchronous wait time in minutes. Default value is 60 minutes-wt
Arguments for pac admin create

The main ones we’re focused on for this simple command here are going to be –name, –type, and –domain. I’m not worried about the others for this use case. All I’m going to do now, is create a simple developer environment to test this out.

So I’m now going to input this command to the terminal and hit enter.

pac admin create --name "Power Platform Dev" --type Developer --domain powerplatformdev

Things should take a little while to finish up, and if things were successful you’ll see a message suggesting things completed with a status code of OK, followed by details of the environment you just created.

Finally, we can also double check that the environment can be seen from the Power Platform Admin Center (

And there we go! I can also now see my environment in the admin center.

Upcoming content

This is just the first of many more posts going through the Power Platform developer tools covering a number of topics within tools such as the Power Platform CLI, through to the Dataverse development tools such as the configuration migration tool, and ALM tools such as the Power Platform Build Tools for DevOps or GitHub actions! 😎

That’s right! This is going to be a pretty chunky series, so make sure you’re subscribed to get all of my upcoming content on the Power Platform developer tools and more! 📩

Posted in Dataverse, Power Platform Dev Tools

Leave a Reply

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

This will close in 0 seconds