Skip to main content

NAV 2013 R2 - Multi-Tenancy Part 3

Hi all,

Previous Post in this series are -

In This post we will move to next steps to Creating Multiple Tenants From Customer Database.

Till Now, We have separated the Application, Data Part, Configured Service Tier & Mount The Application & Customer Data in Service Tier.


STEPS -

5. Importing Modules.

For Creating Multiple Tenants we require Some Modules which can be found in NAV 2013 R2 DVD Inside Folder WindowsPowerShellScripts - Multitenancy

Copy the Multitenancy Folder in D Drive, till we complete the Process.











Delete the content of PowerShell and Paste Below Commands.
------------------------------------------------------------------------------------
#Import Module
Import-Module 'D:\Multitenancy\NAVMultitenancySamples.psm1' -Verbose
------------------------------------------------------------------------------------
You need to change these things -
- Path for Modules.

Run the Command, the Modules are imported.

6. Creating Multiple Tenants.

Tasks need to Perform –

  - Move a Company or set of Companies to a new Tenant from Default tenant.
  - Dismount Tenant if Multiple Company.
  - Remove the Company or set of Companies from Default Tenant once Moved.
  - Mount Tenant.

In My Case i want this set of Tenants as shown below-




Delete the content of PowerShell and Paste Below Commands and execute.
------------------------------------------------------------------------------------
#Move Company 1 Data To IT Tenant

HowTo-MoveCompanyToTenant -ServerInstance ‘MultiTenent’ -DatabaseServer 'localhost\NAVDEMO' -FromDatabase 'ABC Company Database NAV 2013 R2' -CompanyName 'IT Services - Hardware' -OldTenantName 'default' -NewTenantName 'IT' -ServiceAccount 'NT AUTHORITY\NETWORK SERVICE' -RemoveCompanyWhenMoved

Dismount-NAVTenant MultiTenent -Tenant IT -Force

#Move Company 2 Data To IT Tanent
HowTo-MoveCompanyToTenant -ServerInstance ‘MultiTenent’ -DatabaseServer 'localhost\NAVDEMO' -FromDatabase 'ABC Company Database NAV 2013 R2' -CompanyName 'IT Services - Software' -OldTenantName 'default' -NewTenantName 'IT' -ServiceAccount 'NT AUTHORITY\NETWORK SERVICE' -RemoveCompanyWhenMoved
------------------------------------------------------------------------------------







You need to change these things -
- Server Instance, Database Name, Old Tenant Name, New Tenant Name & Company Name.

During Execution you might end up with a warning that tenant IT Already exist, Do you want to continue. Just click Yes.

Run the command.

Delete the content of Powershell and Paste Below Commands and execute.
------------------------------------------------------------------------------------
#Move Data To FB Tanent
HowTo-MoveCompanyToTenant -ServerInstance ‘MultiTenent’ -DatabaseServer 'localhost\NAVDEMO' -FromDatabase 'ABC Company Database NAV 2013 R2' -CompanyName 'Clothing' -OldTenantName 'default' -NewTenantName 'FB' -ServiceAccount 'NT AUTHORITY\NETWORK SERVICE' -RemoveCompanyWhenMoved

Dismount-NAVTenant MultiTenent -Tenant FB -Force

#Move Data To FB Tanent
HowTo-MoveCompanyToTenant -ServerInstance ‘MultiTenent’ -DatabaseServer 'localhost\NAVDEMO' -FromDatabase 'ABC Company Database NAV 2013 R2' -CompanyName 'Food-Beverages' -OldTenantName 'default' -NewTenantName 'FB' -ServiceAccount 'NT AUTHORITY\NETWORK SERVICE' -RemoveCompanyWhenMoved
------------------------------------------------------------------------------------







You need to change these things -
- Server Instance, Database Name, Old Tenant Name, New Tenant Name & Company Name.

Run the command.

Let's Check the SQL Server.


So What happened when we executed the above two commands is, it took the companies from default database and moved them to respective tenants as per the command. For Two Tenants the two databases have been created in SQL.

Let's See the Service tier.


















So as you can see we have multiple tenants in Service Tier.

Now's let’s check the windows client.










As you can see, each tenant have respective company as we wanted.

Commands used in this post can be found in My Sky Drive Folder.

File Name - Command 5 - Split Application Part & Customer Data Part.ps1

I don’t want to have this Default tenant so In the Next Post of this series we will see how we can remove the default tenant by moving the company and deleting this tenant.

Stay Tuned.

Regards,
By Saurav Dhyani

Comments

Popular posts from this blog

BC 21 and Higher - PowerShell Cmdlet (Replacement of Business Central Administration).

Hi Readers, As discussed in last article about deprecating of Business Central Administration, there are few common actions that we use in administration till Business Central 20. For our on-prem customers, we will still require doing activities. As Microsoft suggest we need to start using PowerShell cmdlet.    Let's see how to do those via PowerShell, or Administration Shell. I will be keep adding commands as you comment to this article.

Send Mail with Attachment From Navision.

Hi all, We have seen how to save a report into PDF and how to send mail to a customer. Let's link these two post in one i.e. Mailing statement to a customer into PDF Format. This article is part of the Series. Please Refer  Table of Content here . If you have the old objects set let me brief you what I will be changing - 

MSDYN365BC - Data Upgrade To Microsoft Dynamics 365 Business Central on premises.

Hi Readers, We have already talked about the number of steps for upgrading to Business Central on Premises from different NAV versions. After that article, I received multiple requests for an article which list down steps for Data Migration. In this article, we will discuss steps of data migration to MSDYN365BC (on-Prem) from NAV 2017. For this article, I am considering a Cronus Demo Database without any customization. For an actual upgrade project, we will have to complete object merge using compare and Merge process. After the Merge Process, the next step is data migration. Let's discuss those steps. Direct Upgrade to Microsoft Dynamics 365 Business Central (on-Prem) is from following versions - 1. NAV 2015. 2. NAV 2016. 3. NAV 2017. 4. NAV 2018.