共用方式為


Multitenant Deployment Architecture

Microsoft Dynamics NAV 2013 R2 supports deployments where several different companies access a centrally maintained Microsoft Dynamics NAV application. By using this multitenancy support, you can add new customers to your solution easily, and you can roll out updates quickly with limited downtime for your customers.

Important

You do not have to turn your Microsoft Dynamics NAV 2013 R2 solution into a multitenant deployment. You can install and run Microsoft Dynamics NAV 2013 R2 as a classic one-server-one-database deployment.

In a multitenant deployment, information about the Microsoft Dynamics NAV application is stored in a separate application database. Your customers’ data is stored in separate business databases, each of which is a tenant in your deployment. By separating application from data, you can deploy the same solution to many customers with centralized maintenance of the application and isolation of each tenant. The application database contains the tables that define an application, such as the Object table and other system tables.

For example, if your current solution contains 10 companies in the Microsoft Dynamics NAV database, you can choose to create separate Microsoft Dynamics NAV 2013 R2 databases to store each company’s business data. The knowledge about the shared application is then stored in a dedicated application database. Microsoft Dynamics NAV includes Windows PowerShell cmdlets that create an application database, and other cmdlets that enable you to create and administer tenant-specific databases.

You can choose to upgrade to Microsoft Dynamics NAV 2013 R2 and not change your deployment so that you still have a single database that has one or more companies in it. You can also choose to extract the application-wide tables to an application database but still have one business data database that has one or more companies in it. In both scenarios you have not migrated to multitenancy, but in the second scenario you have prepared your solution so that you can move to multitenancy at a later point.

Tenants, Companies, and Databases

A tenant is an entity that uses your solution and stores data in a business database. This is often either a business or a group of legal entities whose data can be stored in one database. In practical terms, a tenant is a database that stores business data for one or more Microsoft Dynamics NAV companies. Each tenant is connected to a Microsoft Dynamics NAV Server instance, but the Microsoft Dynamics NAV Server instance can support multiple tenants.

When you deploy and maintain a Microsoft Dynamics NAV 2013 R2 solution, you must activate the relationship between the Microsoft Dynamics NAV Server instance and the tenant by running the Mount_NAVTenant cmdlet. Similarly, to disconnect a tenant, you run the Dismount_NAVTenant cmdlet. For more information, see Microsoft Dynamics NAV Windows PowerShell Cmdlets.

When you refer to a tenant, you refer to it by the tenant ID. The first tenant that is mounted against a Microsoft Dynamics NAV Server instance has the tenant ID default. However, you can choose to set up host names for the tenants in your deployment. For example, if you want a tenant to access Microsoft Dynamics NAV through a URL, you can set up a tenant-specific subdomain. The users in that tenant will then access Microsoft Dynamics NAV through a URL such as https://mytenant.myservice.com. The tenant host name, mytenant.myservice.com, must be specified as an alternative ID in the tenant configuration. You can specify alternative IDs for a tenant by using the Mount-NAVTenant Windows PowerShell cmdlet.

Companies

A tenant database can contain one or more Microsoft Dynamics NAV companies. It is not the number of companies in a database that determines whether you are running a multitenant environment. The deciding factor is whether you have created an application database, and if you have more than one tenant database connected to the application database.

Databases

When information about the application is stored in a separate application database, you maintain the application centrally without affecting the various tenants that use the application. Each tenant database contains the business data for one or more specific companies and does not contain all of the application metadata.

For example, if you want to modify a report, and your solution is used by 25 customers, you modify the report in the application database. When each customer then accesses the report, they see the modified report.

Deployment Scenarios Supported in Microsoft Dynamics NAV 2013 R2

The following table compares deployment scenarios.

Includes application database No. of business databases per application database No. of companies in business database Multitenant deployment

No

1

1

No

Yes

1

1

No

Yes

2

2

Yes

Yes

2

1

Yes

Yes

2

2

Yes

In the table, the number of companies and business databases are shown as either 1 or 2. But most of the time there are either 1 or more than 2.

The table describes different deployments of a Microsoft Dynamics NAV solution. For example, a deployment with one database and a single company versus a deployment with two or more business databases for each application database. Of those two scenarios, only the second is a multitenant deployment because it connects multiple tenant databases (the business databases) with a single application database. The table also illustrates that you can have multiple companies in a business database. Finally, you can have an application database and a single business database that contains multiple companies. This is a single-tenant deployment.

The Application in Multitenant Deployments

In a Microsoft Dynamics NAV application that is used in a multitenant deployment, some areas require you to set up web services. Since web services are created in the application database, you must create at least one tenant that has write access to the application database. This setting is determined by the Allow Application database writes parameter when you mount a tenant against a Microsoft Dynamics NAV Server instance.

For example, you can create a dedicated administration tenant that you mount against the Microsoft Dynamics NAV Server instance when you create web services for an application.

If you have an existing Microsoft Dynamics NAV application that you want to use in a multitenant deployment, there are a number of changes that you have to make. This includes setting up the permission sets in a way that supports all tenants that use that application.

URLs and Tenants

In multitenant deployments, URLs must specify the tenant that the URL applies to. If you have C/AL code that constructs URLs, you must update the code to include the tenant. Alternatively, update your code with the GETURL Function to get the URLs calculated for you. The same applies to hyperlinks in report objects, for example.

The URL can specify the tenant ID or the tenant host name if you specify host names as alternative IDs for tenants. For example, the following URL consumes the Customer ODATA web service for a specific tenant:

https://localhost:7048/DynamicsNAV/OData/Company('CRONUS%20International%20Ltd.')/Customer?Tenant=Tenant1

If the mytenant.myservice.com host name has been specified as an alternative ID for the tenant Tenant1, then the following URL returns the same ODATA web service:

http://mytenant.myservice.com:7048/DynamicsNAV/OData/Company('CRONUS%20International%20Ltd.')/Customer

See Also

Tasks

How to: Mount or Dismount a Tenant on a Microsoft Dynamics Server Instance

Concepts

Migrating to Multitenancy
Microsoft Dynamics NAV Windows PowerShell Cmdlets

Other Resources

Upgrading to Microsoft Dynamics NAV 2013 R2