Sunday, October 16, 2016

Setup Microsoft Dynamics CRM Organizations on High Availability For SQL

Introduction



An availability group listener is a virtual network name (VNN) to which clients can connect in order to access a database in a primary or secondary replica of an Always On availability group. An availability group listener enables a client to connect to an availability replica without knowing the name of the physical instance of SQL Server to which the client is connecting. The client connection string does not need to be modified to connect to the current location of the current primary replica.

So, you need to configure CRM to connect to the virtual VNN or the listener VNN



Use The Code

This will be applied after creating the new organization normally in CRM, because CRM installing window (UI) doesn't have a way to configure the VNN.

So, when you're going to create new organization, make the organization connecting to one of  SQL servers suppose "SQL1"

Then after the new organization creation, run the following query against CONFIG_MSCRM,
the following query will update the connection string in from SQL1 to VNN 

UPDATE Organization
SET    ConnectionString =
"provider=SQLOLEDB;Data Source=CRMAG-LSNR;Initial Catalog=SOMECRMORG_MSCRM;Integrated Security=SSPI;Multisubnetfailover=true"