For this blog, I wanted to provide an overview of the multi-tenancy capabilities we added in CRM 4.0. Multi-tenancy refers to a single CRM server being able to support multiple organizations.
With CRM 4, you might have noticed that we create a new database called MSCRM_CONFIG. This is what we refer to as “Config DB” and contains information about the organizations (such as location of its database etc) in the deployment.
There are a couple of ways in which you can create multiple organizations. Note that the ability to create multiple organizations is not supported in all CRM SKUs.
Use Deployment manager to create a new organization (All Programs -> Microsoft CRM -> Deployment Manager). You need to be a member of Deployment Administrators group to run this tool. The user who installed CRM is added as a member of this group automatically. Deployment manager will collect information such as name of the organization, currency settings, sql server etc and create a new organization.
Programatically thru’ the CrmDeploymentService.asmx (http://<crmserver>/MSCRMServices/2007/CrmDeploymentService.asmx ).
The code snippet below assumes you have generated a proxy against the above web service.
First, create an instance of Organization class and specify properties of the organization you want to create.
Organization myOrg = new Organization();
myOrg.UniqueName = “TestOrg”;
myOrg.FriendlyName = “Display Name for TestOrg”;
myOrg.SqlServerName = “testsql”; // Replace this with the name of your sql server.
myOrg.SrsUrl = “http://localhost/ReportServer”; // Replace this with the name of your SRS Server URL.
myOrg.BaseCurrencyCode = “USD”;
myOrg.BaseCurrencyName = “US Dollar”;
myOrg.BaseCurrencySymbol = “$”;
Next, create an instance of the CrmDeploymentService proxy and execute the CreateRequest on it. Provisioning a new organization can take some time, so be sure to override the default timeout to a reasonably high value.
CrmDeploymentService deploymentService = new CrmDeploymentService();
deploymentService.Timeout = 10 * 60 * 1000; // 10 minutes.
CreateRequest request = new CreateRequest();
request.Entity = myOrg;
CreateResponse response = (CreateResponse)deploymentService.Execute(request);
There are some additional considerations to keep in mind when the crm deployment service is installed. In particular, the deployment service role should be installed as a domain account. For this reason, it is recommended that you dedicate a separate server to run the deployment service. We should have more detailed documentation going Live shortly on installing the deployment service and I’ll update this article with links to the documentation when they are available.
Switching between multiple organizations: If you are a member of multiple organizations, you can indicate which organization you want to access in the URL as follows: http://<mycrmserver>/<orgname> — For example, http://localhost/foo would indicate you want to access the organization named foo.
The CRM Live offering provides organization-specific URLs to access an organization (https://foo.crm.dynamics.com for example).