Move-NAVTenant

The shared schema feature is for use in conjunction only with Microsoft hosted offerings in Dynamics 365, is unsupported in Business Central, and may not be used outside Dynamics 365.

Syntax

Move-NAVTenant
    [-Tenant] <TenantId>
    [-DestinationTenantDatabaseId] <TenantDatabaseId>
    [-ImmediateSourceTenantRemoval]
    [-ServerInstance] <String>
    [-Force]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

Use the Move-NAVTenant cmdlet to move a tenant from its current database to another tenant database that is mounted on the same Business Central Server instance.

The source tenant must be mounted this server instance, and must be in Operational state. The destination tenant database must also be mounted on this server instance. The destination tenant database can contain other tenants.

During the move operation, tenant data will be copied from the source tenant database to the destination tenant database. This process will run in exclusive access mode, which means that all current sessions to the tenant will be disconnected, and new sessions to the tenant are prevented.

The tenant data in the source tenant database will then be deleted. You can use the -ImmediateSourceTenantRemoval parameter to specify how this data is deleted. If you omit the parameter, the data is deleted by a system task in Task Scheduler. The task will run in the time period that is defined by the server instance configuration settings: TaskSchedulerSystemTaskStartTime and TaskSchedulerSystemTaskEndTime. If you use the -ImmediateSourceTenantRemoval parameter, the data is deleted immediately without using the system task.

The result of running the cmdlet is as follows:

  • If the move operation is successful, the tenant is mounted on the destination tenant database in the Operational state. A record of the original tenant remains mounted on the source tenant database, except its name has been suffixed with a GUID. For example, 'tenant1' becomes 'tenant10dda87eff3dd40af9be4748ea6987491'. Use the Get-NAVTenant cmdlet to get the new name. The original tenant will have the state 'Soft Deleted', 'Deleting', or 'Deleted' so it cannot be accessed. To remove this tenant from the source tenant database, wait until the state is 'Deleted', then manually dismount it by using the Dismount-NAVTenant cmdlet.
  • If the move operation fails, the tenant data is restored in the source tenant database and the tenant will have the same state it had before the move operation. The destination tenant database will not contain any of the tenant's data.

Examples

EXAMPLE 1

Move-NAVTenant -ServerInstance NavServer -SourceTenant TenantA -DestinationDatabase DatabaseB

This example moves 'TenantA' from its current tenant database to tenant database 'DatabaseB' on server instance 'NavServer'. Both tenant 'TenantA' and tenant database 'DatabaseB' must be mounted on the server instance 'NavServer'.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DestinationTenantDatabaseId

Specifies the ID of the tenant database to which you want to move the tenant. This tenant database must be mounted on the server instance.

Type:TenantDatabaseId
Position:2
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Force

Forces the command to run without asking for user confirmation.

Type:SwitchParameter
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-ImmediateSourceTenantRemoval

Specifies to delete the source tenant, its companies, and global data immediately after the data has been copied to the destination database; instead of using a scheduled system task.

Type:SwitchParameter
Position:Named
Default value:False
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ServerInstance

Specifies the name of a Business Central Server instance, for example, BC or myinstance. You can specify either the full name of an instance, such as MicrosoftDynamicsNavServer$myinstance or the short name such as myinstance.

Type:String
Position:0
Default value:None
Accept pipeline input:True (ByPropertyName, ByValue)
Accept wildcard characters:False
-Tenant

Specifies the ID of the tenant that you want to move to another tenant database. This tenant must be mounted on the server instance.

Type:TenantId
Aliases:Id
Position:1
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

Microsoft.Dynamics.Nav.Types.TenantId

By property name: Tenant

Microsoft.Dynamics.Nav.Types.TenantDatabaseId

By property name: DestinationTenantDatabaseId

System.Management.Automation.SwitchParameter

By property name: ImmediateSourceTenantRemoval

System.String

ServerInstance