Guide contents

Deploying a unified developer environment using PowerShell

Updated

This was the first experience available, and it’s pretty straightforward, you just need to change the value of the parameters to your needs.

#Install the module
Install-Module -Name Microsoft.PowerApps.Administration.PowerShell

Write-Host "Creating a session against the Power Platform API"

Add-PowerAppsAccount -Endpoint prod

#To construct the json object to pass in
$jsonObject= @" 
{ 
 "PostProvisioningPackages": 
 [ 
 { 
 "applicationUniqueName": "msdyn_FinanceAndOperationsProvisioningAppAnchor", 
"parameters": "DevToolsEnabled=true|DemoDataEnabled=true" 
 } 
 ] 
} 
"@ | ConvertFrom-Json

# To kick off new environment Provisionment
# IMPORTANT - This has to be a single line, after the copy & paste the command
New-AdminPowerAppEnvironment -DisplayName "MyUniqueNameHere" -EnvironmentSku Sandbox -Templates "D365_FinOps_Finance" -TemplateMetadata $jsonObject -LocationName "Europe" -ProvisionDatabase

This script will install the PPAC PowerShell admin cmdlets and deploy a Dataverse environment with the selected template in the JSON object.

License templatesLink to section: License templates

Depending on the license that your user has, you need to select a different template:

LicenseTemplate ID
Dynamics 365 FinanceD365_FinOps_Finance
Dynamics 365 Supply Chain Management (preview)D365_FinOps_SCM
Dynamics 365 Project OperationsD365_FinOps_ProjOps
Dynamics 365 Operations Application Partner SandboxD365_FinOps_ProjOps
Dynamics 365 CommerceD365_FinOps_Commerce

The parameters you need to change are:

  • DisplayName: the name of your environment on PPAC. This will also be used as the URL if it has less than 20 characters.
  • EnvironmentSku: Production or Sandbox. Generally, for a UDE it will be a Sandbox environment.
  • Templates: select the appropiate one depending on your license. See the table above.
  • LocationName: the region where the environment will be deployed.

Set custom domain nameLink to section: Set custom domain name

Additionally, there are two more parameters you can use: DomainName and FirstRelease.

FirstRelease will mark the environment to get the new features earlier.

DomainName will set the domain name part of your environment. This one is a good one, and I must thank Aurélien Clere and Rachit Garg for the tip.

Why is the domain name parameter useful and important? Well, if you use the DisplayName parameter only, that will set the Dataverse environment name, and if it’s unique, also its URL.

If the display name is not unique, you will get one of those orgXXXXXXXXX URLs for your Dataverse environment, and that will also be your F&O environment URL too. An ugly one.

Using the DomainName parameter will make sure that doesn’t happen.

After running the script, and authenticating, the process takes between 1h 15m and 1h 30m to complete.

3 comments

  1. Shakir Shabbir

    Hi Ariste,

    Can you tell what does the following command corresponds to:

    Add-PowerAppsAccount -Endpoint prod

    -Endpoint prod sounds scary deploying a DEV environment.

    1. Adrià Ariste SantacreuAuthor

      It’s used to add your user account to the process, and it defines it as being in a production region and not the government clouds (GCC, DOD, China, etc…).

  2. Isabella

    This was super helpful, thanks – The manual deploy was not working for me – the development tool option did not shop up in PPac, så this scipt wiith explanation saved my day.

Comments are closed.