What datacenter is my dataverse instance in?

What datacenter is my dataverse instance in?

When you create an instance in dataverse you get to choose which region it is located in. However, you do not get to choose which exact datacenter you get. How is this important? Well, if you want to mirror data using Azure Synapse Link or Microsoft Fabric, then these resources have to be in the exact same datacenter to work. If you have several instances, there is a risk that some are in one of the datacenters in the region and some in the other. For instance, in the region Europe, there are two datacenters, North Europe (Dublin) and West Europe (Amsterdam). So, it might very well be that some instances are in Dublin and some in Amsterdam.

Currently there is only one way to move an instance, and that is to create a ticket and ask Microsoft Support to do it for you. But you first need to know where it is.

The easiest way to find where you instance is located, is actually to start the wizard for synchronizing data to a datalake using Azure Synapse Link from the Maker-portal. It should look something like this:

However, if you have many instances, you might want to have a script that outputs this. Well, I did anyway, so I was looking into how to do this using Powershell.

Hence I dug into some of the PowerShell libraries for Power Platform and created this PowerShell script:

# Get all environments
$environments = Get-AdminPowerAppEnvironment

# Loop through each environment and output DisplayName and azureRegionHint to a file
$environments | ForEach-Object {
    # Create a custom object with the properties you want
    [PSCustomObject]@{
        DisplayName = $_.DisplayName
        Type = $_.EnvironmentType
        azureRegionHint = $_.Internal.properties.azureRegionHint
    }
} | Export-Csv -Path "C:\temp\output.csv" -NoTypeInformation

In this case the “azureRegionHint” was supposed to show the right datacenter. But that turned out to be a half-truth as many of the instances were correct but not all. I suspect it might be stored list and not the actual list, as at least one of the ones that were incorrect has been moved.

I reported this to Microsoft support, as my view is that the azureRegionHint should display the correct datacenter, and hence what I experienced is a bug. But I never got this acknowledged by support who instead recommended that I use “ping” to figure out the region;

C:\Users\GustafWesterlund>ping xxx.crm4.dynamics.com

Pinging db3--eurcrmlivesg000.crm4.dynamics.com [52.155.235.153] with 32 bytes of data:
Reply from 52.155.235.153: bytes=32 time=56ms TTL=107
Reply from 52.155.235.153: bytes=32 time=55ms TTL=107
Reply from 52.155.235.153: bytes=32 time=69ms TTL=107
Reply from 52.155.235.153: bytes=32 time=75ms TTL=107

Ping statistics for 52.155.235.153:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 55ms, Maximum = 75ms, Average = 63ms

In the response above, db is “Dublin” and my guess is that the “3” means datacenter 3 or something like that.

However, using ping to do what in essence is a nslookup didn’t seem very useful and I also wanted to be able to use PowerShell, so I looked up the command:

Resolve-DnsName -Name $url

This is in essence nslookup, which, if you are not very versed in this, will give you the IP address and official name of a specific alias (cname). As the following example shows:

PS C:\WINDOWS\system32> Resolve-DnsName -Name xxx.crm4.dynamics.com

Name                           Type   TTL   Section    NameHost                                                                                                                               
----                           ----   ---   -------    --------                                                                                                                               
xxx.crm4.dynamics.com     CNAME  300   Answer     db3--eurcrmlivesg000.crm4.dynamics.com                                                                                                 

Name       : db3--eurcrmlivesg000.crm4.dynamics.com
QueryType  : AAAA
TTL        : 300
Section    : Answer
IP6Address : 2603:1061:2002:968::36


Name       : db3--eurcrmlivesg000.crm4.dynamics.com
QueryType  : A
TTL        : 300
Section    : Answer
IP4Address : 52.155.235.153

The first part is the information that the DNS entry is a cname/alias to the aname which starts with db3. The following two blocks are the IPs in IP v6 and IP v4 of this name. Using this I adapted my script and added a manual switch which shows the datacenter which starts with “ams” as West Europe and “db3” as North Europe. Don’t know if this information is available anywhere so that I can look it up instead as that would be a lot more dynamic. But at least I can loop through all instances and get the azure datacenter for each of the instances. Here is the script:

$connectionhost = "https://admin.services.crm4.dynamics.com"
$output = New-Object System.Collections.Generic.List[System.Object]
foreach ($inst in Get-CrmInstances -ApiUrl $connectionhost | Select-Object -Property FriendlyName, ApplicationUrl)
{
    $url = $inst.ApplicationUrl.Substring(8,$inst.ApplicationUrl.Length - 9)
    
    $dns = Resolve-DnsName -Name $url
    $center = ""
    switch($dns[1].Name.Substring(0,3)) {
    "ams" {
        $center = "West Europe" }
    "db3" {
        $center = "North Europe" }
    }

    $out = [PSCustomObject]@{
        Name = $inst.FriendlyName
        url = $dns[1].Name
        AzCenter = $center
    }

    $output.Add($out)
}
$output | Format-Table -Property Name, AzCenter, url

I hope and guess there are easier ways to solve this. If you have any ideas, please let me know in the comments or if you have any other method to solve this for a lot of instances where using the UI would be a bit too much of a hassle.

Hope it helps!

Working with CrmSettings via PS – setting things you didn’t know you could, or should

Working with CrmSettings via PS – setting things you didn’t know you could, or should

Recently I have been trying to fix some Server Side Sync issues with an on-prem Dyn CRM 2016 and this got me to dig into the nitty gritty of settings for the system.

Before going berserk and chaning a lot of these settings, be aware that you can cause severe problems with your system if you are not careful so I would strongly recommend that you test any settings and also export any settings so that you know what they are.

Finetuning your onprem installation is something that you can do with an onprem that is a lot harder with online.

By logging in on your CRM-server, and opening Powershell and entering the following command, you can start working with some settings that are otherwise hard or impossible to reach:

Add-PSSnapin Microsoft.Crm.PowerShell

For instance, if you want to check out some of the ServerSideSync Settings, enter:

Get-CrmSetting -SettingType ServerSideSyncQueueSettings

If you are using the Windows Power Shell ISE, after loading the Microsoft.Crm.PowerShell, you will get intellisense that will help you see which different settings are available. So if you write:

Get-CrmSetting -SettingType

And then enter a space after this, you will see the different options:

For some more details into Server side sync and how to configure this in detail, look here:
https://download.microsoft.com/download/7/1/D/71D44C6E-CB78-4573-BDFF-77A6E137BA5C/serversidesyncwithDynamicsCRM.pdf

And here is an example of how to set data.

$set = Get-CrmSetting -SettingType ServerSideSyncQueueSettings 

$set.MailboxQueueItemsInMemoryHigh = “500” 
$set.MailboxQueueItemsInMemoryLow = “200” 

Set-CrmSetting -Setting $set

Just add more $set – statements to set more values.

If you want to write some settings to a file, just pipe the output to a file, for example:

Get-CrmSetting -SettingType ServerSideSyncQueueSettings > ServerSideSyncSettingsOrg.txt

But as I mentioned above, be careful with these settings.

Gustaf Westerlund
MVP, Founder and Principal Consultant at CRM-konsulterna AB
www.crmkonsulterna.se

Extending Max amount of components on dashboards only for onprem

Extending Max amount of components on dashboards only for onprem

Some of you might have found some sites like this https://msdynamicscrmblog.wordpress.com/2014/05/23/how-to-change-the-dashboardsettings-of-maximum-controls-limit-in-dynamics-crm20112013/
one:

I, Soupeurfaive, via Wikimedia Commons

or even the original MSDN or Technet sites regarding how to be able to change the maximum amount of components on a dashboard from the maximum of 6 to for instance 8 using PowerShell.

On the MSDN and Technet pages there are some default CRM version text in the header and footer but make no misstake, you can only do this change in a CRM onprem environment where you are the deployment admin.

As the change is deployment wide and you need to have deployment administrator access rights, you are also extremely unlikely (unless you have a dedicated Online environment) to get that set.

Gustaf Westerlund
MVP, Founder and CTO at CRM-konsulterna AB
www.crmkonsulterna.se