Are you accidentally connecting to the wrong instance of CRM? While I was working on a custom application the other day, I found that using “friendly name” over “unique name” can trigger this.
Here’s how: The connection string’s URL parameter uses the format “https://organization-name.crm.dynamics.com,” which means the organization-name is required. You can specify either the friendly or the unique name of the organization to connect to. However, you may not be aware that when making connections, the Tooling Connector prioritizes unique name over friendly name.
For example, I have two instances of CRM Online. The Development instance has a URL of “https://ABCCom.crm.dynamics.com” and a unique name of “org99999.” The Production instance has a URL of “ABCCompany.crm.dynamics.com” and a unique name of “ABCCom.”
Now let’s say I want to connect to the Development instance of CRM, and I write this code:
var connectionString = "Url=https://ABCCom.crm.dynamics.com; Usernamefirstname.lastname@example.org; Password=password1; authtype=Office365"
var conn = new Microsoft.Xrm.Tooling.Connector.CrmServiceClient(connectionString);
Based on the URL I defined in the code, I would expect it to connect to the Development instance of CRM, but this is not the case. This code will connect to the Production instance of CRM because the precedence of the URL parameter is unique name first, then friendly name. The Tooling Connector will take “ABCCom” and look for an instance of CRM that has that unique name. If it does not find one, then it will look for an instance of CRM with that exact URL or friendly name. In order to be sure you are connecting to the correct instance of CRM, always use the unique name in the URL parameter:
Writing the URL parameter in this format will connect to the Development instance of CRM.
It’s Always Good to Double Check
Keep in mind, this issue may not come up that often anymore because you no longer specify the unique name of your CRM instances. In the past, you were able to specify this value as something meaningful. Now Microsoft automatically generates the unique name, usually starting with “org” and followed by some numbers and letters. However, it’s good to be aware that this issue could still happen and to double check that you’ve connected to the Development instance.
Click here to view the documentation for connection strings. While it talks about using a unique name and friendly name in the URL, it does not mention the precedence of those values.
If you have any questions on this topic, contact Wipfli. We would be glad to discuss it further and provide advice tailored to your situation.