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 templates #
Depending on the license that your user has, you need to select a different template:
License | Template ID |
---|---|
Dynamics 365 Finance | D365_FinOps_Finance |
Dynamics 365 Supply Chain Management (preview) | D365_FinOps_SCM |
Dynamics 365 Project Operations | D365_FinOps_ProjOps |
Dynamics 365 Operations Application Partner Sandbox | D365_FinOps_ProjOps |
Dynamics 365 Commerce | D365_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 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.