Tip #1077: Connect to the right instance

As Guido “Future Olive Farmer” Preite has discovered, sometimes CrmServiceClient may connect to the wrong instance. Just like that.

Dynamics 365 instances now can be backed up and restored at will. The side-effect of this awesomeness is that URLs and unique names may no longer match, leading to the fun times with connections. Here’s the scenario:

  • Instance https://foo.crm.dynamics.com with a unique name bar
  • Backup and restore that instance into https://bar.crm.dynamics.com, the unique name will be something like org1234567
  • If you use CrmServiceClient with a connection string that points to https://bar.crm.dynamics.com, it may actually connect to the first instance.

If you do experience this behavior, the workaround is to specify organization unique name in the connection string, i.e. use https://org1234567.crm.dynamics.com as URL parameter.

Thanks to Clément “French but not Tanguy” Olivier for the workaround and Matt “SDK Deity” Barbour for explaining the scenario.

(Facebook/Twitter cover photo by John Carlisle on Unsplash)

Leave a Reply

Your email address will not be published. Required fields are marked *