3.2 Extension Deployment & Schema Synchronization Modes
Key Takeaways
- Business Central extensions are deployed through four core channels: VS Code direct publishing (F5/Ctrl+F5) for sandboxes, Web Client Extension Management upload for Per-Tenant Extensions (PTE), Business Central Admin Center for AppSource apps, and PowerShell cmdlets for on-premises/Docker automation.
- Schema synchronization reconciles AL table definitions and field modifications with physical SQL database structures, managing companion extension tables ($ext) transparently.
- The Synchronize (Add) schema update mode validates that all database schema alterations are strictly additive and non-destructive, protecting existing business data across sandbox and production deployments.
- The Recreate mode drops and rebuilds all database tables defined by the extension, completely wiping existing table data, and is strictly restricted to development sandbox environments.
- The ForceSync mode forces destructive schema changes (dropping columns, shrinking field lengths, changing primary keys) into the SQL schema, permanently destroying affected column data, and is prohibited in cloud production.
3.2 Extension Deployment & Schema Synchronization Modes
Deploying extensions to Microsoft Dynamics 365 Business Central requires aligning compiled AL packages (.app files) with the target environment's application server and underlying relational database schema. Because Business Central applications manage mission-critical enterprise data, the AL platform enforces strict schema synchronization rules to prevent data corruption and unintentional data loss.
1. Extension Deployment Channels & Deployment Architecture
There are four distinct deployment channels for Business Central extensions, each designed for specific environments and operational tiers:
| Deployment Channel | Target Environments | Mechanism | Package Scope |
|---|---|---|---|
VS Code Direct Publishing (F5 / Ctrl+F5 / Alt+F5) | Development Sandboxes & Docker Containers | Uses Developer Endpoint (/dev/apps) to compile, publish, sync, and install | Per-Tenant Development |
Extension Management Page (Upload Extension) | Production & Sandbox Cloud Tenants | Web Client upload (.app file) deploying via asynchronous server background task | Per-Tenant Extension (PTE) |
| Business Central Admin Center | Cloud Production & Sandbox Environments | Admin Center App Management for AppSource Apps and tenant-wide updates | AppSource & Global PTE |
| PowerShell Cmdlets | On-Premises & Local Docker Containers | Administrative PowerShell scripts managing server-tier publishing and tenant sync | Global, AppSource & PTE |
The PowerShell Deployment Pipeline (On-Premises & Docker)
For on-premises installations and automated CI/CD container environments, extension deployment follows a mandatory three-step PowerShell lifecycle:
# Step 1: Publish the extension package to the server instance
Publish-NAVApp -ServerInstance BC240 -Path "C:\Apps\ContosoCustomization_1.0.0.0.app" -SkipVerification
# Step 2: Synchronize the extension schema with the tenant database
Sync-NAVApp -ServerInstance BC240 -Tenant default -Name "Contoso Customization" -Version 1.0.0.0 -Mode Synchronize
# Step 3: Install the extension on the target tenant
Install-NAVApp -ServerInstance BC240 -Tenant default -Name "Contoso Customization" -Version 1.0.0.0
Publish-NAVApp: Uploads the compiled.appbinary into the Business Central Server's application metadata store. The extension becomes known to the server but is not yet active on any tenant.Sync-NAVApp: Reconciles table definitions in the extension with the physical SQL Server database schema for the specified tenant.Install-NAVApp: Activates the extension for users on the specified tenant, running install codeunits (Subtype = Install) and binding event subscribers.
2. Schema Synchronization Modes in Detail
When deploying extensions from Visual Studio Code or running Sync-NAVApp, the schemaUpdateMode property in launch.json dictates how the platform handles differences between the existing SQL database schema and the updated AL table definitions.
{
"name": "Cloud Sandbox - ForceSync Development",
"type": "al",
"request": "launch",
"environmentType": "Sandbox",
"environmentName": "DevSandbox",
"schemaUpdateMode": "ForceSync"
}
The Three Synchronization Modes
1. Synchronize (Default / Additive)
- Behavior: Strictly validates that all changes made to tables and table extensions are additive or backward-compatible.
- Allowed Modifications: Adding new tables, adding new fields to existing tables/table extensions, adding secondary keys, widening string/code fields (e.g.,
Text[50]toText[100]), and changing field captions. - Prohibited Modifications: Removing fields, decreasing field lengths, changing field data types, deleting tables, or removing primary key fields.
- Failure Handling: If any destructive change is detected, synchronization terminates with a runtime schema validation error, and deployment aborts with zero data loss.
- Production Availability: Yes. This is the only mode used during routine cloud production deployments.
2. Recreate (Drop and Rebuild — Sandbox Only)
- Behavior: Completely drops all physical SQL tables belonging to the extension and recreates fresh, empty tables matching the current AL source code.
- Data Impact: Total data destruction for all tables declared in the extension. Base application tables and tables from other extensions remain unaffected.
- Use Case: Rapid early-stage development when developers frequently redesign table structures, change primary keys, or refactor data models and do not require existing test data.
- Production Availability: Strictly Blocked. The Business Central SaaS platform rejects any deployment attempt with
schemaUpdateMode = Recreatetargeting production.
3. ForceSync (Destructive Schema Alignment)
- Behavior: Compares the new AL table definitions with the current database schema and forces the database to match the new definitions, even if destructive modifications exist.
- Data Impact: Deletes columns and permanently wipes data residing in removed fields, truncated fields (shortened strings), or modified data types. Intact fields retain their data.
- Use Case: Iterative development where a developer wants to delete or modify specific experimental fields without wiping the entire database table.
- Production Availability: Strictly Blocked in SaaS Production. Permitted only in Sandbox environments and on-premises development instances.
3. Safe vs. Destructive Schema Modifications
Understanding which modifications are classified as safe versus destructive is essential for passing the MB-820 exam and maintaining operational stability in enterprise environments.
| Schema Operation | Classification | Synchronize | ForceSync | Recreate | Production Impact |
|---|---|---|---|---|---|
| Add new table | Safe | Allowed | Allowed | Allowed | Table created in SQL |
| Add new field to table/table extension | Safe | Allowed | Allowed | Allowed | Column added in SQL |
Increase field length (Text[30] -> Text[50]) | Safe | Allowed | Allowed | Allowed | SQL column altered (ALTER TABLE) |
| Add secondary key | Safe | Allowed | Allowed | Allowed | SQL Index created |
Decrease field length (Text[50] -> Text[30]) | Destructive | Blocked | Allowed | Allowed | Data truncated / Column modified |
Change field data type (Integer -> Code[20]) | Destructive | Blocked | Allowed | Allowed | Column dropped and recreated |
| Delete existing field | Destructive | Blocked | Allowed | Allowed | SQL column dropped, data destroyed |
| Modify Primary Key fields | Destructive | Blocked | Allowed | Allowed | SQL Clustered Index rebuilt / dropped |
| Delete entire table | Destructive | Blocked | Allowed | Allowed | SQL table dropped, all data destroyed |
4. Deploying Per-Tenant Extensions (PTE) in Production
When deploying a Per-Tenant Extension (.app) to a live production environment via the Extension Management page (Page 2500):
- The administrator uploads the compiled
.apppackage. - The administrator selects the deployment target version: Current version (deploys immediately to the active platform release) or Next minor / Next major version (schedules deployment during the next scheduled platform update).
- The platform validates the extension using the PTE Analyzer and schema validator. If any breaking schema changes or missing dependencies are detected, the deployment task fails without altering the live tenant database.
- An asynchronous background worker executes the installation, runs
Installcodeunits, and completes the activation without taking the system offline.
Exam Warning: If an extension containing destructive schema changes must be deployed to Production, developers cannot use
ForceSync. Instead, they must follow the Deprecation Lifecycle: retain the obsolete fields marked withObsoleteState = Removed, create new fields, transfer data via anUpgradecodeunit, and delete references gracefully.
A developer in a local development Sandbox is radically restructuring several custom tables and needs to completely delete and rebuild all tables defined by the extension, wiping existing test records. Which schemaUpdateMode in launch.json should be selected?
Which sequence of PowerShell cmdlets must an administrator execute to upgrade an on-premises Business Central extension from version 1.0.0.0 to version 2.0.0.0?
When deploying a Per-Tenant Extension (.app) via the Business Central Web Client Extension Management page, which of the following represents a valid deployment target option?
A partner attempts to deploy a Per-Tenant Extension (PTE) update to a customer's live Production SaaS environment using the Extension Management page. The new version accidentally deletes an obsolete table field. What will occur during deployment?