Multi-tenancy in CRM 4


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).

Jagan Peri

Comments (23)

  1. There is an interesting post over at blogs.msdn.com

  2. Jebb says:

    May I know what version of CRM 4.0 is capable of Multi tenancy? When we try to create new organization in our CRM 4.0, it gives the following message:

    "To create a new organization, the wizard must remove the current organization company name. After the wizard completes you will no longer have access to this organization. Are you sure you want to continue?"

  3. Jagan Peri says:

    From the deployment SDK documentation:

    "Note   Microsoft Dynamics CRM 4.0 Workgroup Edition and Professional Edition do not include support for multiple customer organizations."

    The deployment SDK is available for download at:

    http://blogs.msdn.com/crm/archive/2008/01/22/crm-4-0-deployment-sdk-is-now-available.aspx )

  4. Federico says:

    Jagan,

    How do you know at runtime which organization is being used at the moment (in the current context)? Parsing the url won't work always because you might be in a virt dir with a custom page. Is there anyway to query the user's principal or identity?

    Thanks,

    Federico.

  5. Benjamin says:

    My question about this new capability of CRM 4, is if you will lose our not the possibility of a general view of the conpanies. For exemple it´s possible with multy-tenancy to have a overall view of all company´s oportunities ?

    Thanks

  6. Benjamin says:

    Hello

    Using multi-tenancy capability it´s possible to create several organization in the same server. In a second stage it´s possible to integrate the several organization so that the top management has a complete picture of the group of company´s ?

    Thanks

    Benjamin

  7. Jagan Peri says:

    Hi Benjamin,

      You bring up a good question. CRM 4.0 doesnt offer any capabilities to integrate/present data across multiple organizations...

     Depending on your requirements, you might want to consider using Business Units within an organization to model your usage rather than use multiple organizations...

    thanks

    Jagan

  8. Jagan Peri says:

    Hi Federico,

    You might want to look at the following msdn article for more info:

    http://msdn2.microsoft.com/en-us/library/cc151050.aspx

    In some cases, we do parse the URLs to map the incoming request to an org. For the case you are talking about, your code needs to create an auth token before making SDK calls as shown in the above MSDN article.

    thanks

    Jagan

  9. Benjamin says:

    Hi Jagam

    I find this news about CRM 4 in yahoo website:  

    "Microsoft added multitenant capabilities with version 4.0 of the product, which means a single instance of the software on a server can serve multiple customers when the suite is running as a hosted service. The company also added more support for global companies, giving customers a single view for managing accounts worldwide and adding support for multiple currencies."

    http://news.yahoo.com/s/pcworld/20080131/tc_pcworld/142056

    However i have been told that you can you can setup the users for multiple organization access view.

    Can you help me to analise this information?

  10. prabhu says:

    when i try to create a new organization in mscrm 4.0 through deployment manager, after completing all the wizards finally i am getting an error "crmexception:configure organization utility cannot run on a domain controller machine"

  11. For those nerds like me that are interested in developing your own Microsoft Dynamics CRM 4.0 MPS Provider

  12. Toiletduck says:

    The CRM 4 deployment document mention that the following command can be executed to "Preventing CRM Users from Adding (Disabling the Create User Feature)"

    Microsoft.Crm.DeploymentConfigTool OrgFeatureSettings -Organization:AdventureWorks -CreateUser:false

    Is it possible to update the organization feature settings to disable the user creation process via the API?

  13. Nelson says:

    I wrote an article on importing and deleting organizations on my blog at:

    http://eccosystem.blogspot.com/2008/04/install-and-delete-ms-crm-organization.html

  14. Gangadhar says:

    I have created ,two organization and made some customization in second organization's(added custom attributes for account).

    Lets say Org1 while intalation,Org2 added later .Now working with Org2.

    In a custom website for the second organization,i am using the CRMService reference,but iam unable to work with the custom attributes of account.

    How to go about this?

  15. After some basic checking of CRM 4.0 system, it’s now time to import some sample data and test further.

  16. crosspost from http://blogs.msdn.com/rextang After some basic checking of CRM 4.0 system, it’s now time

  17. Robert says:

    Hey Great post thanks.  Question....The logo at the top left of the screen in CRM.  Can it be customized to be the logo of each unique Organization?

  18. Dan Blake says:

    Robert,

    You can replace the logo on the header of the CRM screen by replacing two image files on the CRM application server.  The files are under the _imgs folder and are named mast_back.gif and hasthead.jpg.  This is not a supported customization and may violate the license agreement (consult your attorney...).  These files may get replaced with the Microsoft version if you do a CRM upgrade or apply a hotfix.

    For anyone interested, I posted an article "A Primer on Multitenancy for Microsoft Dynamics CRM"  at http://thecrmarchitect.wordpress.com/2009/01/05/a-primer-on-multi-tenanancy-for-microsoft-dynamics-crm/

  19. Dan Blake says:

    Oops...make that "masthead.jpg" in the comment above.

  20. Piyush says:

    I have created ,two organization and made some customization in second organization's(added custom attributes for account).

    Lets say Org1 while intalation,Org2 added later .Now working with Org2.

    In a custom website for the second organization,i am using the CRMService reference,but iam unable to work with the custom attributes of account.

    How to go about this?

    can someone please reply on above point.

  21. David Martinez Fresneda says:

    Hi piyush , did you publish changes in crm, and actualize web references in visual studio project?.

  22. Glen says:

    Is it possible to set different logo jpg's for different organizations in a multi-org config?

  23. soujanno says:

    Great Post. Thanks

Skip to main content