Sync-NAVApp

Synchronizes a Business Central app to the specified tenant's database.

Syntax

Sync-NAVApp
    [-ServerInstance] <String>
    -Name <String>
    [-Publisher <String>]
    [-Version <Version>]
    [-Tenant <TenantId>]
    [-Mode <NavAppSyncMode>]
    [-ExclusiveAccessTicket <String>]
    [-PassThru]
    [-Force]
    [<CommonParameters>]
Sync-NAVApp
    [-ServerInstance] <String>
    -Name <String>
    [-Publisher <String>]
    [-Version <Version>]
    [-TenantDatabaseId <TenantDatabaseId>]
    [-Mode <NavAppSyncMode>]
    [-PassThru]
    [-Force]
    [<CommonParameters>]
Sync-NAVApp
    [-ServerInstance] <String>
    -Path <String>
    [-Tenant <TenantId>]
    [-Mode <NavAppSyncMode>]
    [-ExclusiveAccessTicket <String>]
    [-PassThru]
    [-Force]
    [<CommonParameters>]
Sync-NAVApp
    [-ServerInstance] <String>
    -Path <String>
    [-TenantDatabaseId <TenantDatabaseId>]
    [-Mode <NavAppSyncMode>]
    [-PassThru]
    [-Force]
    [<CommonParameters>]

Description

Use the Sync-NAVApp cmdlet to synchronize the schema changes from an app to a tenant database. You must run this cmdlet after you publish an app to the server; otherwise you will not be able to install the app on tenants. This must be done after you publish an app for the first time and for each new version that you publish for upgrade. For more information, see Publishing and Installing an Extension and Upgrading Extensions

You can also use this cmdlet to delete the all versions of an app from the tenant database, after all versions have been uninstalled from the tenant, and eventually unpublished. For more information, see Unpublishing and Uninstalling Extensions.

Examples

EXAMPLE 1

Sync-NAVApp -ServerInstance BC -Id 'Test_Database' -Name 'Proseware SmartApp' -Publisher Proseware -Version 2.3.4.500 -Mode Add

This example synchronizes the Business Central app 'Proseware SmartApp' to a tenant database with the ID 'Test_Database'.

EXAMPLE 2

Sync-NAVApp -ServerInstance BC -Path '.\Proseware SmartApp.app' -Tenant 'Tenant1'

This example synchronizes the app at the specified path to the tenant database for the tenant with the ID 'Tenant1'.

EXAMPLE 3

Sync-NAVApp -ServerInstance BC -Tenant 'Tenant1' -Name 'Proseware SmartApp' -ExclusiveAccessTicket $ticket

This example synchronizes the Business Central app 'Proseware SmartApp' to the tenant database for the tenant with the ID 'Tenant1'. 'Tenant1' is in exclusive access mode and $ticket is the exclusive access ticket.

EXAMPLE 4

Sync-NAVApp -ServerInstance BC -Tenant 'Tenant1' -Name 'Proseware SmartApp' -Mode Clean

This example uses the '-Mode' parameter to synchronize the tenant database for the tenant with the ID Tenant1 and remove the schema entities created by the Business Central app 'Proseware SmartApp' (for example, tables and table extension related objects).

Parameters

-ExclusiveAccessTicket

Specifies the exclusive access ticket allowing this operation on the tenant in the exclusive access mode.

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

-Force

Forces the command to run without asking for user confirmation.

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

-Mode

The sync mode that dictates the behavior of the command. Specifies how the database schema for the tenant database is synchronized with the database schema that the target Business Central app's objects define.

Add: The database schema defined by the objects in the target Business Central app are added to the database schema of the target tenant database. That is, if a table or table extension was included in the target Business Central app, then the respective full or companion table is created in the tenant database. You will use this mode after you publish an extension for the first time.

Clean: The database schema defined by all versions of the target Business Central app will be removed from the target tenant database and all data is lost. That is, if a table or table extension was included in any version of the target Business Central app, then the respective full or companion table will be dropped from the tenant database.

Note

You cannot synchronize in clean mode if any version of the extension is installed on a tenant of the server instance. Moreover, in production, this should primarily be done as a final cleanup step after all versions of an extension have been uninstalled and unpublished for good.

Development: This mode is acts similar to Add, except it is intended for use during development. It enables you to sync the same version of an App that is already published, eliminating the need to increase the version number. However, to run this mode, only one version the App can be currently published.

ForceSync: This mode is also intended for use during development, but unlike the Development and Add modes, it supports destructive schema changes (like removing fields, renaming them, changing their datatypes, and more). This mode is useful in development because it enables you to make these kinds of changes without losing data. Because destructive changes are not backwards compatible, this mode should not be used in production. To use this mode, the App must first be uninstalled from the tenant.

Type:NavAppSyncMode
Accepted values:Add, Clean, Development, ForceSync
Position:Named
Default value:Add
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Name

Specifies the name of the Business Central app that you want to synchronize. The results must uniquely identify a single Business Central app.

Type:String
Aliases:AppName
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-PassThru

Returns an Extension object for the synced Extension. The Extension object contains the properties of the Extension, such as name, publisher, version.

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

-Path

Specifies the path to a Business Central app package file that you want to synchronize. When using this parameter, the Tenant or TenantDatabaseId parameters must be specified.

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

-Publisher

Specifies the publisher of the Business Central app that you want to synchronize. The results must uniquely identify a single Business Central app.

Type:String
Aliases:AppPublisher
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ServerInstance

Specifies the Business Central Server instance that the Business Central app is published to, such as BC.

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

-Tenant

Specifies the ID of a specific tenant that you want to act on, such as Tenant1.

Type:TenantId
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-TenantDatabaseId

Specifies the ID of a specific tenant database that you want to act on, such as Data1.

Type:TenantDatabaseId
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Version

Specifies the version of the Business Central app that you want to synchronize. The results must uniquely identify a single Business Central app.

Type:Version
Aliases:AppVersion
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

Inputs

System.String

By value and by property name: ServerInstance

System.String

By property name: Name

System.String

By property name: Publisher

System.Version

By property name: Version

System.String

By property name: Path

Microsoft.Dynamics.Nav.Types.TenantId

By property name: Tenant

Microsoft.Dynamics.Nav.Types.TenantDatabaseId

By property name: TenantDatabaseId

Microsoft.Dynamics.Nav.Types.NavAppSyncMode

By property name: Mode

System.String

By value and by property name: ExclusiveAccessTicket