Get-NAVTenant
Gets the tenants that are mounted against the specified Business Central Server instance.
Syntax
UseNST (Default)
Get-NAVTenant
    [[-Tenant] <TenantId>]
    [-ServerInstance] <String>
    [-RetryMode <RetryMode>]
    [-NetworkTimeout <TimeSpan>]
    [-MaxRetries <Int32>]
    [-DelayBetweenRetries <TimeSpan>]
    [-Force]
    [-ProgressAction <ActionPreference>]
    [<CommonParameters>]
		UseDatabaseSqlAuth
	   
	Get-NAVTenant
    [[-Tenant] <TenantId>]
    -ApplicationDatabaseServer <String>
    -ApplicationDatabaseCredentials <PSCredential>
    -ApplicationDatabaseName <String>
    [-RetryMode <RetryMode>]
    [-NetworkTimeout <TimeSpan>]
    [-MaxRetries <Int32>]
    [-DelayBetweenRetries <TimeSpan>]
    [-Force]
    [-ProgressAction <ActionPreference>]
    [<CommonParameters>]
		UseDatabase
	 
	Get-NAVTenant
    [[-Tenant] <TenantId>]
    -ApplicationDatabaseServer <String>
    -ApplicationDatabaseName <String>
    [-RetryMode <RetryMode>]
    [-NetworkTimeout <TimeSpan>]
    [-MaxRetries <Int32>]
    [-DelayBetweenRetries <TimeSpan>]
    [-Force]
    [-ProgressAction <ActionPreference>]
    [<CommonParameters>]
		ForceRefreshTenantState
	   
	Get-NAVTenant
    [-Tenant] <TenantId>
    [-ServerInstance] <String>
    [-ForceRefresh]
    [-RetryMode <RetryMode>]
    [-NetworkTimeout <TimeSpan>]
    [-MaxRetries <Int32>]
    [-DelayBetweenRetries <TimeSpan>]
    [-Force]
    [-ProgressAction <ActionPreference>]
    [<CommonParameters>]
Description
Gets the tenants that are mounted against the specified Business Central Server instance. You can use the Mount-NAVTenant and Dismount-NAVTenant cmdlets to mount and dismount tenants.
Examples
EXAMPLE 1
Get-NAVTenant -ServerInstance 'BusinessCentral'
    ServerInstance                         : BusinessCentralServer$BusinessCentral
    TenantDatabaseId                       : TenantDB1
    State                                  : Mounted
    DetailedState                          :
    IsInExclusiveAccessMode                : False
    TenantDataVersion                      : 'Uninitialized'
    Id                                     : Tenant1
    AlternateId                            : {}
    AllowAppDatabaseWrite                  : True
    NasServicesEnabled                     : False
    RunNasWithAdminRights                  : False
    EncryptionProvider                     : LocalKeyFile
    AzureKeyVaultSettings                  :
    DefaultCompany                         :
    DefaultTimeZone                        : UTC
    ExchangeAuthenticationMetadataLocation : https://*.microsoft.com/,https://outlook.office365.com/,https://*.outlook.com/
    AadTenantId                            : common
This example gets the tenant information from the Business Central Server instance called 'BusinessCentral'. The output is a list of the tenant information about all mounted tenants, in this case two tenants. In this example, the server instance is configured to use the shared schema data model. If your instance is not running the shared schema data model, instead of the 'TenantDatabaseId', 'DatabaseName', 'DatabaseServer', and 'DatabaseUserName' are listed. ---------- EXAMPLE 2 ----------
Get-NAVTenant -ServerInstance 'BusinessCentral' -Tenant 'Tenant1' -ForceRefresh
ServerInstance                         : BusinessCentralServer$BusinessCentral
TenantDatabaseId                       : TenantDB1
State                                  : Operational
DetailedState                          :
IsInExclusiveAccessMode                : False
TenantDataVersion                      : 13.0.17887.0
Id                                     : Tenant1
AlternateId                            : {}
AllowAppDatabaseWrite                  : True
NasServicesEnabled                     : False
RunNasWithAdminRights                  : False
EncryptionProvider                     : LocalKeyFile
AzureKeyVaultSettings                  :
DefaultCompany                         :
DefaultTimeZone                        : UTC
ExchangeAuthenticationMetadataLocation :
https://.microsoft.com/,https://outlook.office365.com/,https://.outlook.com/ AadTenantId : common
This example gets the information about the tenant with the ID 'Tenant1' on Business Central Server instance 'BusinessCentral'. By setting the -ForceRefresh parameter, the 'State' and 'TenantDataversion' are refreshed to display the actual values (as compared to the first example).
Parameters
-ApplicationDatabaseCredentials  
		Specifies the user name and password of the login account that the Business Central Server instance uses to access the application database in SQL Server when using SQL Server Authentication.
This parameter is only relevant when you set with the ApplicationDatabaseServer and ApplicationDatabaseName parameters
Parameter properties
| Type: | PSCredential | 
| Default value: | None | 
| Supports wildcards: | False | 
| DontShow: | False | 
Parameter sets
					UseDatabaseSqlAuth 
					
				   
				| Position: | Named | 
| Mandatory: | True | 
| Value from pipeline: | False | 
| Value from pipeline by property name: | True | 
| Value from remaining arguments: | False | 
-ApplicationDatabaseName  
		Specifies the name of the application database that is used by the tenant database. This parameter is only relevant if the Business Central Server instance is configured for multitenancy.
This parameter, together with the ApplicationDatabaseServer parameter, enables you to dismount a tenant from a Business Central Server instance without having a running connection to the Business Central Server instance.
Parameter properties
| Type: | String | 
| Default value: | None | 
| Supports wildcards: | False | 
| DontShow: | False | 
Parameter sets
					UseDatabaseSqlAuth 
					
				   
				| Position: | Named | 
| Mandatory: | True | 
| Value from pipeline: | False | 
| Value from pipeline by property name: | True | 
| Value from remaining arguments: | False | 
					UseDatabase 
					
				 
				| Position: | Named | 
| Mandatory: | True | 
| Value from pipeline: | False | 
| Value from pipeline by property name: | True | 
| Value from remaining arguments: | False | 
-ApplicationDatabaseServer  
		Specifies the SQL Server name and instance, such as MyServer\MyInstance, that hosts the application database that is used with the tenant database.
This parameter, together with the ApplicationDatabaseName parameter, enables you to get the tenants that are mounted on a Business Central Server instance without having a running connection to the Business Central Server instance.
Parameter properties
| Type: | String | 
| Default value: | None | 
| Supports wildcards: | False | 
| DontShow: | False | 
Parameter sets
					UseDatabaseSqlAuth 
					
				   
				| Position: | Named | 
| Mandatory: | True | 
| Value from pipeline: | False | 
| Value from pipeline by property name: | True | 
| Value from remaining arguments: | False | 
					UseDatabase 
					
				 
				| Position: | Named | 
| Mandatory: | True | 
| Value from pipeline: | False | 
| Value from pipeline by property name: | True | 
| Value from remaining arguments: | False | 
-DelayBetweenRetries  
		Specifies the delay between retries.
Parameter properties
| Type: | TimeSpan | 
| Default value: | None | 
| Supports wildcards: | False | 
| DontShow: | False | 
Parameter sets
(All)
| Position: | Named | 
| Mandatory: | False | 
| Value from pipeline: | False | 
| Value from pipeline by property name: | False | 
| Value from remaining arguments: | False | 
-Force
Forces the command to run without asking for user confirmation.
Parameter properties
| Type: | SwitchParameter | 
| Default value: | None | 
| Supports wildcards: | False | 
| DontShow: | False | 
Parameter sets
(All)
| Position: | Named | 
| Mandatory: | False | 
| Value from pipeline: | False | 
| Value from pipeline by property name: | False | 
| Value from remaining arguments: | False | 
-ForceRefresh 
		Specifies to update a tenant's state and data version based, in part, on the data version of the tenant database that contains the tenant. By default, the data retrieved by the Get-NAVTenant is not necessarily up to date with the tenant database. This can happen, for example, after a Business Central Server instance restart. In this case, the 'State' would be 'Mounted', even if its actual state is 'Operational', and the 'TenantDataVersion' would be 'Uninitialized'. By setting the -ForceRefresh parameter, the server instance reads the data version of the tenant database from the database itself, and the tenant's state and data version are recalculated. Note: Running operations, such as sync, mount and dismount, on a specific tenant always ensures that tenant settings are up-to-date with the tenant database.
Parameter properties
| Type: | SwitchParameter | 
| Default value: | False | 
| Supports wildcards: | False | 
| DontShow: | False | 
Parameter sets
					ForceRefreshTenantState 
					
				   
				| Position: | Named | 
| Mandatory: | True | 
| Value from pipeline: | False | 
| Value from pipeline by property name: | True | 
| Value from remaining arguments: | False | 
-MaxRetries 
		Specifies the maximum number of retries for the operation in case of failure.
Parameter properties
| Type: | Int32 | 
| Default value: | None | 
| Supports wildcards: | False | 
| DontShow: | False | 
Parameter sets
(All)
| Position: | Named | 
| Mandatory: | False | 
| Value from pipeline: | False | 
| Value from pipeline by property name: | False | 
| Value from remaining arguments: | False | 
-NetworkTimeout 
		Specifies the network timeout of the operation.
Parameter properties
| Type: | TimeSpan | 
| Default value: | None | 
| Supports wildcards: | False | 
| DontShow: | False | 
Parameter sets
(All)
| Position: | Named | 
| Mandatory: | False | 
| Value from pipeline: | False | 
| Value from pipeline by property name: | False | 
| Value from remaining arguments: | False | 
-ProgressAction 
		A common PowerShell parameter that determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider. Learn more.
Parameter properties
| Type: | ActionPreference | 
| Default value: | None | 
| Supports wildcards: | False | 
| DontShow: | False | 
| Aliases: | proga | 
Parameter sets
(All)
| Position: | Named | 
| Mandatory: | False | 
| Value from pipeline: | False | 
| Value from pipeline by property name: | False | 
| Value from remaining arguments: | False | 
-RetryMode 
		Specifies the retry mode when the service instance is not available.
Possible values: Fixed, Exponential
Parameter properties
| Type: | RetryMode | 
| Default value: | None | 
| Accepted values: | Fixed, Exponential | 
| Supports wildcards: | False | 
| DontShow: | False | 
Parameter sets
(All)
| Position: | Named | 
| Mandatory: | False | 
| Value from pipeline: | False | 
| Value from pipeline by property name: | False | 
| Value from remaining arguments: | 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.
Parameter properties
| Type: | String | 
| Default value: | None | 
| Supports wildcards: | False | 
| DontShow: | False | 
Parameter sets
UseNST
| Position: | 0 | 
| Mandatory: | True | 
| Value from pipeline: | True | 
| Value from pipeline by property name: | True | 
| Value from remaining arguments: | False | 
					ForceRefreshTenantState 
					
				   
				| Position: | 0 | 
| Mandatory: | True | 
| Value from pipeline: | True | 
| Value from pipeline by property name: | True | 
| Value from remaining arguments: | False | 
-Tenant
Specifies the ID of the specific tenant that you want to get information about, such as Tenant1.
If you do not set the Tenant parameter, the Get-NAVTenant cmdlet returns all tenants that are mounted against the Business Central Server instance.
When using Get-NAVTenant through a connection to a Business Central Server instance, if the specified tenant ID is not found, then an error occurs. When using Get-NAVTenant through a connection to the application database, if the specified tenant ID is not found, then all mounted tenants are returned in the results.
Parameter properties
| Type: | TenantId | 
| Default value: | None | 
| Supports wildcards: | False | 
| DontShow: | False | 
| Aliases: | Id | 
Parameter sets
UseNST
| Position: | 1 | 
| Mandatory: | False | 
| Value from pipeline: | False | 
| Value from pipeline by property name: | True | 
| Value from remaining arguments: | False | 
					UseDatabaseSqlAuth 
					
				   
				| Position: | 1 | 
| Mandatory: | False | 
| Value from pipeline: | False | 
| Value from pipeline by property name: | True | 
| Value from remaining arguments: | False | 
					UseDatabase 
					
				 
				| Position: | 1 | 
| Mandatory: | False | 
| Value from pipeline: | False | 
| Value from pipeline by property name: | True | 
| Value from remaining arguments: | False | 
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Inputs
System.String
You can pipe the ServerInstance as a string to this cmdlet.
Outputs
Microsoft.Dynamics.Nav.Types.NavTenantSettings
Returns a Microsoft.Dynamics.Nav.Types.NavTenantSettings object for each tenant. The following information is returned:
ServerInstance TenantDatabaseId State DetailedState IsInExclusiveAccessMode TenantDataVersion (see notes) Id AlternateId AlternateId AllowAppDatabaseWrite NasServicesEnabled RunNasWithAdminRights EncryptionProvider DefaultCompany DefaultTimeZone ExchangeAuthenticationMetadataLocation
Notes
- The Tenant Data Version indicates the version of the tenant data. When and how the version is assigned can be explained by the following upgrade flow: - When an application is created, it is assigned an Application Version.
- When a tenant database is upgraded, the Application Version is transferred to the tenant database.
- When data upgrade is executed on the tenant data. the Application Version is transferred to the Tenant Database Version field.
- When the upgrade process is completed, the tenant database will have the same version as the application (schema is synchronized) and the tenant data is the same as the application (tenant data has been upgraded).
 
- To run this cmdlet, management API services must be enabled on the Business Central server instance. For more information, see Configure Business Central Server.