Set-NAVTenant

Sets the tenant to acquire or release exclusive access.

Syntax

Set-NAVTenant
   [-Tenant] <TenantId>
   [-Force]
   -Compression <CompressionType>
   [-ServerInstance] <String>
   [-ProgressAction <ActionPreference>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-NAVTenant
   [-Tenant] <TenantId>
   [-AcquireExclusiveAccess]
   [-Justification] <String>
   [-Force]
   [-ServerInstance] <String>
   [-ProgressAction <ActionPreference>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-NAVTenant
   [-Tenant] <TenantId>
   [-ReleaseExclusiveAccess]
   [[-ExclusiveAccessTicket] <String>]
   [[-Justification] <String>]
   [-Force]
   [-ServerInstance] <String>
   [-ProgressAction <ActionPreference>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

When exclusive access is acquired by a tenant, any existing client sessions with the tenant are disconnected, and new sessions with the tenant are denied. Exclusive access is useful while upgrading the tenant because it prevents changes to data by other sessions. The cmdlet returns an exclusive access ticket, in the form of a text string. You will use the ticket to run other cmdlets that perform operations on the tenant, such as Dismount-NAVTenant. You also use the ticket when you release the tenant from exclusive access by using the -ReleaseExclusiveAccess parameter.

Examples

EXAMPLE 1

$exclusiveAccessTicket = Set-NAVTenant -ServerInstance BCServer -Tenant TenantB -Justification "Perform exclusive operation on tenant before dismount" -AcquireExclusiveAccess
Set-NAVTenant -ServerInstance BCServer -Tenant TenantB -ExclusiveAccessTicket $exclusiveAccessTicket -ReleaseExclusiveAccess

This example illustrates how to acquire and release tenant exclusive access mode. You can use $exclusiveAccessTicket to perform operations on the tenant when it is in the exclusive access mode.

EXAMPLE 2

$exclusiveAccessTicket = Set-NAVTenant -ServerInstance BCServer -Tenant TenantB -Justification "Perform exclusive operation on tenant before dismount" -AcquireExclusiveAccess
Dismount-NAVTenant -ServerInstance BCServer -Tenant TenantB -ExclusiveAccessTicket $exclusiveAccessTicket

This example illustrates how to dismount a tenant when it is in the exclusive access mode. You do not have to explicitly release exclusive access mode for the dismounted tenant.

Parameters

-AcquireExclusiveAccess

Establishes exclusive access to the tenant. Any existing client sessions with the tenant are disconnected, and new sessions with the tenant are denied. Exclusive access is useful while upgrading the tenant because it prevents changes to data by other sessions. The cmdlet returns an exclusive access ticket, in the form of a text string. You will use the ticket to run other cmdlets that perform operations on the tenant, such as Dismount-NAVTenant. You also use the ticket when you release the tenant from exclusive access by using the -ReleaseExclusiveAccess parameter.

Type:SwitchParameter
Position:2
Default value:False
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Compression

Specifies the compression level to use for the tenant database. Actual compression is only enabled for new tables. Existing tables can be compressed with Start-NAVDatabaseCompression.

Possible values: Unspecified, None, Row, Page

Type:CompressionType
Accepted values:Unspecified, None, Row, Page
Position:Named
Default value:Unspecified
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

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

-ExclusiveAccessTicket

Specifies the exclusive access ticket to use to release exclusive access. The ticket is returned when you acquire exclusive access by using the -AcquireExclusiveAccess parameter.

Type:String
Position:3
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Force

Forces the command to run without asking for user confirmation. You can also use the -Force parameter to release exclusive access without specifying the -ExclusiveAccessTicket parameter, but you will have to set the -Justification parameter as well.

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

-Justification

Specifies a text string that provides a brief explanation for why you acquire or release exclusive access. The text is for informational/telemetry purposes.

To force release exclusive access instead of using the -ExclusiveAccessTicket parameter, you can use the -Justification parameter together with the -Force parameter.

Type:String
Position:4
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ProgressAction

A common PowerShell parameter that determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider. Learn more.

Type:ActionPreference
Aliases:proga
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ReleaseExclusiveAccess

Releases the tenant from exclusive access, allowing other client sessions to access the tenant. To release exclusive access, you must also either set the -ExclusiveAccessTicket or set the -Force and -Justification parameters.

Type:SwitchParameter
Position:2
Default value:False
Required:True
Accept pipeline input:True
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 MicrosoftDynamicsBCServer$myinstance or the short name such as myinstance.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Tenant

Specifies the ID of the tenant that you want to change. If you are changing the tenant to be a buffer tenant, the tenant cannot be mounted on the Business Central Server Instance; otherwise you will get an error.

Type:TenantId
Aliases:Id
Position:1
Default value:None
Required:True
Accept pipeline input:True
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
Required:False
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: TenantDatabaseId

System.Management.Automation.SwitchParameter

By property name: AcquireExclusiveAccess

System.Management.Automation.SwitchParameter

By property name: AcquireExclusiveAccess

System.String

By property name: ExclusiveAccessTicket

System.String

By property name: Justification

System.String

ServerInstance