RETRIEVING ENVIRONMENT DATACENTER
Sometimes you want to take advantage of the latest functionality, for example, connecting Dataverse with Azure Synapse as documented on https://docs.microsoft.com/en-us/power-apps/maker/data-platform/export-to-data-lake). However, barriers, questions or concerns rise: Synapse requires selecting a “Region” as documented on https://docs.microsoft.com/en-us/azure/synapse-analytics/quickstart-create-workspace-cli#create-an-azure-synapse-workspace-using-the-azure-cli
Then an important question arises: Power Platform Admin Center shows a “region” but is generic:
while Azure components (like Synapse) allows selecting a specific datacenter within each datacenter:
https://azure.microsoft.com/en-us/global-infrastructure/geographies/#geographies
This mean that at some point, Dynamics/Platform environment are created in a region (United Kingdom) but since we don’t have specific information on which of the two datacenters the environment is, the Azure Synapse link might be created in a different datacenter, which would cause an error since environment & Synapse are in different datacenters.
We can take advantage of two different approaches:
- Using Power Automate
Customers can use the “List Environments As Admin” action (from PowerPlatform admin). The output of this action is a JSON File that contains several pairs of settings and one of them is precisely the AzureRegion:
Because this command lists all environments in the tenant, the JSON file can be quite big but can then be processed to retrieve the specific datacenter/AzureRegion that is currently providing the service for each license and with this information, customers can provision their Synapse on the most common datacener.
This is based on Tutorial: Create a daily capacity report (preview) - Power Platform | Microsoft Docs
- Using PowerShell
Customers can also take advantage of using Powershell, as documented on https://docs.microsoft.com/en-us/powershell/module/microsoft.powerapps.administration.powershell/get-adminpowerappenvironment?view=pa-ps-latest. The command, GetAdminPowerApEnvironment. IN the following screenshot we can see the Powershell version (5.1). And using the Microsoft.PoweApps.Administration.Powershell module, we can use the command to retrieve a specific environment and check the internal properties, one of them which exposes the “AzureRegionHint”:
Powershell also provides an additional interesting feature: if customers have their Synapse already created on a specific region, they can use New-adminPowerAppEnvironment command documented on https://docs.microsoft.com/en-us/powershell/module/microsoft.powerapps.administration.powershell/new-adminpowerappenvironment?view=pa-ps-latest and provide not only the LocationName parameter but the AzureRegion. This way, when creating the environment, we can create the environment directly in teh same region as our Synapse repository
This is discussed in detail on (99+) Provision Dynamics 365 CRM and Dataverse environments on Specific region and Datacenter - Dynamics 365 General Forum Community Forum