X
17Oct

Microsoft Dynamics NAV 2013 R2 Multitenancy deployment

Multi-tenancy is a software architecture in which a single instance of the application can be accessed by multiple customers. This is rather simple as a definition, so let us explain the concept of multi-tenancy.

 

Single Tenancy

STNew

 

Multi-Tenancy

 

MTNew

Microsoft Dynamics NAV and Multi-tenancy

Earlier versions of Microsoft Dynamics NAV was known to us as a single tenant software architecture that can be deployed on-premise. With Microsoft Dynamics NAV 2013 R2, which is known to be the most ‘Cloud Ready’ version of NAV, it is possible to deploy multi-tenant architecture. Multi-tenant hosting for Microsoft Dynamics NAV 2013 R2 is available to run on both Microsoft Azure cloud and Partner-hosted deployments. Though, Microsoft Dynamics NAV still can be deployed as single-tenancy mode.

Step – by – step: Microsoft Dynamics NAV 2013 R2 Multi-tenancy deployment on Azure cloud

Before you start with the deployment make sure that a windows azure account is created and a virtual machine is created in the azure cloud. In order to do that, you need to have a windows live id.

Azure

You can also have windows azure account on a free trial basis for limited period.

For more information about creating azure account for free trial, refer to the link http://azure.microsoft.com/en-us/pricing/free-trial/

Once the windows account is on line and the virtual machine is created in windows azure, we will go by the following steps to deploy multi-tenancy architecture for Microsoft Dynamics NAV 2013 R2.

Step: 1

Login to your virtual machine and download Microsoft Dynamics NAV 2013 R2 from partner source.

Step: 2

Install Microsoft Dynamics NAV 2013 R2 into the virtual machine. This installation will take place as a typical single tenant architecture, with default Cronus database and the default product license.  Once installed, have a look into the SQL server management studio and NAV Administrative tool.

BeforeSplit

The demo database which is installed by default, we will consider this database as a staging database. I have created [basically I have copied the demo company Cronus International Ltd.] two more companies named ‘Cronus APAC’ and ‘Cronus EU’ into the same database under the same instance. So now, my installation is typically a single instance and multi-company one. While connecting to the database you will be prompted as follows:

SelectServer

Step: 3  Preparing PowerShell

Run the Windows PowerShell ISE in your virtual machine as ‘Administrator’. Before running any PowerShell command, we need to prepare the PowerShell so that it can run NAV cmdlet. In order to do that we need to run the following scripts in Windows PowerShell ISE:

PP

Once the scripts are ran successfully, the PowerShell is ready to run any NAV cmdlet scripts.

Step: 4 Split ‘Application Database’ and Customer data

Next step is to split the ‘Application Database’ from the customer data. In order to do that, we need to run the following scripts:

1.       Export-NAVApplication -DatabaseServer "localhost" -DatabaseName "Demo Database NAV (7-1)" -DestinationDatabaseName NAV2013R2_App_DB

2.       Remove-NAVApplication -DatabaseServer "localhost" -DatabaseName "Demo Database NAV (7-1)" -Force

The first script is used to split the source database [which is our staging database] and create a new Application Database called NAV2013R2_App_DB. The second script is used to remove the application database from within the source dataset. So literary, now we have two databases. One is “Application Database” and the other is the source database, but the source database doesn’t have the object tables and the system tables. Similarly, the application database doesn’t contain any customer data.

AfterSplit

Step: 5 Preparing the NST [NAV Service Tier] for Multi-tenancy

To prepare the NAV service tier into a Multi-tenant server, we need to execute the following scripts:

1. Set-NAVServerInstance DynamicsNAV71 –stop To stop the NAV service instance

2. SetNAVServerConfiguration -ServerInstance Dynamics71 -KeyName MultiTenant -KeyValue "true" To set the value of Multitenant key value as true

3. SetNAVServerConfiguration -ServerInstance Dynamics71 -KeyName DatabaseName -KeyValue "" To set the database name key value as blank

4. Set-NAVServerInstance DynamicsNAV71 –start To start the NAV service instance

5. Mount-NAVApplication -DatabaseServer "localhost" -DatabaseName NAV2013R2_App_DB -ServerInstance DynamicsNAV71 To mount the “Application Database” in NAV service instance

Step: 6  Create tenants and move companies

The NAV service tier is now running as multi-tenancy and we can mount companies to create new tenants. In the following section we will create three tenants namely W1, APAC and EU. Each of these tenants will hold the following business data: W1--Cronus International Ltd., APAC--Cronus APAC, EU--Cronus EU and all these business data will share the same NAV instance. To do that we need to run the following scripts-

1. Mount-NAVTenant -ServerInstance DynamicsNAV71 -Id W1 -DatabaseName "Demo Database NAV (7-1)" –OverwriteTenantIdInDatabase

2. import-module 'C:\Installer\NAV2013R2_DVD\WindowsPowerShellScripts\Multitenancy\NAVMultitenancySamples' -verbose

At this point we will be able to login to NAV, but the system will ask to specify a tenant as the NAV service is running as multi-tenant.

MTWarning

Once we specify the newly created tenant [i.e. W1 in our case] we will be able to login.

CooseCompany

 

But all other companies are also added into the default tenant [i.e. W1], that is not actually what we want. So we will create more tenants and move the other two companies to their respective tenants. To create a new tenant ‘APAC’ and mount the ‘Cronus APAC’ company to the tenant run the following script:

Get-NAVCompany DynamicsNAV71 -tenant W1 | Where-Object { $_."CompanyName" -like "Cronus APAC"} |HowTo-MoveCompanyToTenant -ServerInstance DynamicsNAV71 -FromDatabase 'Demo Database NAV (7-0)' -OldTenantName W1 -NewTenantName APAC –RemoveCompanyWhenMoved

Same way, to create a new tenant ‘EU’ and mount the ‘Cronus EU’ company to the tenant run the following script:

Get-NAVCompany DynamicsNAV71 -tenant W1 | Where-Object { $_."CompanyName" -like "Cronus EU"} |HowTo-MoveCompanyToTenant -ServerInstance DynamicsNAV71 -FromDatabase 'Demo Database NAV (7-0)' -OldTenantName W1 -NewTenantName EU –RemoveCompanyWhenMoved

The script function –RemoveCompanyWhenMoved is used to remove ‘Cronus APAC’ and ‘Cronus EU’ companies from tenant W1, once they are moved to their respective tenants. Now we have three different tenants and each tenant have their respective business data. All tenants are sharing the same NAV instance [DynamicsNAV71] and same application database [NAV2013R2_App_DB]

Finale

If you want to discuss further on this topic, please feel free to drop me a mail to bijoy.basak@ecanarys.com
 

Related

NAV – Connecting Microsoft Dynamics CRM customized entities

This blog is intended to see how Microsoft Dynamics NAV (here onwards NAV) can be connected to exter...

Read More >

NAV – Connecting External SQL

This blog is intended to see how Microsoft Dynamics NAV (here onwards NAV) can be connected to exter...

Read More >

What's New in Microsoft Dynamics NAV 2017

We were hearing about Dynamics NAV 2017 since long time that it will be releasing by the end of 2016...

Read More >

How to run NAV 2015 and NAV 2016 Administration tool side by side

Everyone would have installed NAV 2016 RTM and would have faced the same problem, i.e, you couldn...

Read More >

What’s new: Extension for Microsoft Dynamics NAV 2016

We all have seen the situation where we need to put in lot of efforts to modify the standard NAV obj...

Read More >

Identify and stop idle Dynamics NAV sessions using User Session Control Addon

Since the advent of RTC clients and 3-tier architecture of Dynamics NAV, it’s been a question ...

Read More >

Autofill RecVariable Name in DynamicsNAV 2015

I discovered something quite interesting couple of week back and I thought it was worth sharing.When...

Read More >

Phenomenal growth of Microsoft Dynamics NAV

There has been phenomenal growth in terms of organizations adopting Microsoft Dynamics NAV in the la...

Read More >

How to Remove the Departments Action Button in NAV 2015

Some customers may not want to use Departments menu available. We need to have some option to remove...

Read More >

How to print Header and Details (Lines) in different pages of a RDLC Report in NAV 2013 R2

We usually print header and details section of a document on same page, what if we want to print on ...

Read More >

Share

Try DevOpSmartBoard Ultimate complete Azure DevOps End-to end reporting tool

Sign Up

  • Recent
  • Popular
  • Tag
Monthly Archive
Subscribe
Name

Text/HTML
Text/HTML
Contact Us
  • *
  • *