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

VIEW SERVER STATE permission on SQL Server?

Hi all, Sometime While trying to Login into a database we face an error message as shown below. --------------------------- Microsoft Dynamics NAV Classic --------------------------- You cannot start Microsoft Dynamics NAV Classic because you do not have the VIEW SERVER STATE permission on SQL Server. Contact your system administrator. --------------------------- OK    ---------------------------

RTC Report It is not possible to instantiate the Visual Studio bridge.

Hi all, As a Navision developers I have Multiple Versions of Navision running in single Machine. As discussed Earlier in the post how to run multiple Version of RTC in single machine. So my machine have following details for RTC Versions - NAV 2009 R2    - is installed. NAV 2009 SP1  - is copied at C:\Program Files (x86)\Microsoft Dynamics NAV\60\NAV 6.0 SP1 IN\ NAV 2009         - is copied at C:\Program Files (x86)\Microsoft Dynamics NAV\60\NAV 6.0 IN\ This approach has been working great for execution of Classic and RTC Clients. However, after installing Dynamics NAV 2009 R2, if i tried to view the Layout for an NAV 2009 SP1 Report i was getting the following error: ---------------------------  Microsoft Dynamics NAV Classic  ---------------------------  It is not possible to instantiate  the Visual Studio bridge.  ---------------------------  OK    --------------------------- After searchi...

NAV 2013 R2 - Cumulative update 12 Released.

Hi all, Please find below the details of  Cumulative Update 12 released for Microsoft Dynamics NAV 2013 R2. Title - Cumulative Update 12 for Microsoft Dynamics NAV 2013 R2 Build No. - 38053 Release Date - October, 2014 Local Version Included - AU, AT, BE, CH, DE, DK, ES, FI, FR, IS, IT, NA, NL, NO, NZ, SE, UK, RU Download Link Note: Implementing this cumulative update will require a database conversion unless you have already implemented update rollup 5.