Upgrade a BC CRONUS Database using Docker

A few days ago I streamed how I try to upgrade a Business Central CRONOS Database just using docker:

Apart from a few throwbacks it went quite well, but better watch yourself 😉

However, I promised to publish the script I created so you don’t need to write it down from the video.

$ContainerNameOld = 'BC17-dev'
$ContainerNameNew = 'BC18-dev'
$TargetVersionBasePath = 'C:\bcartifacts.cache\onprem\18.0.23013.23795'
$BackFolderName = 'C:\ProgramData\BcContainerHelper\DatabaseUpgrade\'
$BackFile17 = Join-Path $BackFolderName 'Database_17.bak'
# Unsinstall all Extensions
Get-BcContainerAppInfo containerName $ContainerNameOld | ForEach-Object { UnInstall-BcContainerApp containerName $ContainerNameOld Name $_.Name Version $_.Version Force }
# Unintall all 'Symbols only' extensions
Get-BcContainerAppInfo containerName $ContainerNameOld SymbolsOnly | ForEach-Object { Unpublish-BcContainerApp containerName $ContainerNameOld Name $_.Name Version $_.Version }
# Backup the database from docker container to docker host
Backup-BcContainerDatabases containerName $ContainerNameOld bakFolder $BackFolderName
#Stop the BC service in the target version container
Invoke-ScriptInBcContainer containerName $ContainerNameNew scriptblock {
Stop-NAVServerInstance ServerInstance BC
# restore the database which should be upgraded to the target version docker container
Restore-DatabasesInBcContainer containerName $ContainerNameNew bakFile $BackFile17
Invoke-ScriptInBcContainer containerName $ContainerNameNew scriptblock {
$DatabaseName = 'Database_17'
Write-Host "Database conversion started"
Invoke-NAVApplicationDatabaseConversion DatabaseServer localhost DatabaseName $DatabaseName
Write-Host "Set the database name to point to the old version database"
Set-NAVServerConfiguration ServerInstance BC KeyName DatabaseName KeyValue $DatabaseName
Write-Host "Disable the task scheduler"
Set-NavServerConfiguration ServerInstance BC KeyName "EnableTaskScheduler" KeyValue false
Write-Host "Restart BC server instance"
Restart-NAVServerInstance ServerInstance BC
# Technical upgrade only
# Get-NAVAppInfo -ServerInstance BC | Repair-NAVApp
# Restart-NAVServerInstance -ServerInstance BC
# Publish the new app versions
# If your target is not BC18 you need the adjust the path ####### here #######
Publish-BcContainerApp containerName $ContainerNameNew appFile (Join-Path $TargetVersionBasePath "\platform\ModernDev\program files\Microsoft Dynamics NAV\180\AL Development Environment\System.app") PackageType SymbolsOnly
Publish-BcContainerApp containerName $ContainerNameNew appFile (Join-Path $TargetVersionBasePath "\de\Applications\System Application\Source\Microsoft_System Application.app")
Publish-BcContainerApp containerName $ContainerNameNew appFile (Join-Path $TargetVersionBasePath "\de\Applications\BaseApp\Source\Microsoft_Base Application.app")
Publish-BcContainerApp containerName $ContainerNameNew appFile (Join-Path $TargetVersionBasePath "\de\Applications\Application\Source\Microsoft_Application.app")
# Sync apps and start their data upgrade
Invoke-ScriptInBcContainer containerName $ContainerNameNew scriptblock {
$NewVersion = '18.0.23013.23795'
Sync-NAVTenant ServerInstance BC Tenant default Mode Sync
Sync-NAVApp ServerInstance BC Tenant default Name "System Application" Version $NewVersion Mode ForceSync
Sync-NAVApp ServerInstance BC Tenant default Name "Base Application" Version $NewVersion Mode ForceSync
Sync-NAVApp ServerInstance BC Tenant default Name "Application" Version $NewVersion Mode ForceSync
Start-NAVAppDataUpgrade ServerInstance BC Name "System Application" Version $NewVersion
Start-NAVAppDataUpgrade ServerInstance BC Name "Base Application" Version $NewVersion
# Lines 30 – 44 can be adapted to upgrade other MS extensions as well
# If you have custom extensions or other ISV or third party extensions you would want to upgrade them as well using these steps
# Get-BcContainerAppInfo -containerName $ContainerNameNew -SymbolsOnly
### After upgrade ###
Invoke-ScriptInBcContainer containerName $ContainerNameNew scriptblock {
Set-NavServerConfiguration ServerInstance BC KeyName "EnableTaskScheduler" KeyValue true
Restart-NAVServerInstance ServerInstance BC

Have Fun 😉

8 thoughts on “Upgrade a BC CRONUS Database using Docker

  1. Imagine there would be a Cmdlet in the BcContainerHelper to perform a CU /Minor Update.
    Some pieces need to be parametrization, but doesn’t looks impossible.

    Liked by 2 people

  2. Hello Stefan,

    Thanks for this video. It seems to be easy and fast when you explain the upgrade process.

    I tried your script between version 20.1 and 20.2 but I have the following issue when i used the Invoke-NAVApplicationDatabaseConversion

    A technical upgrade of database ‘database’ on server ‘LOCALHOST’ cannot be run, because the database�s application version ‘131250’ is greater than or equal to the platform versio
    n ‘131250’.

    Do you have a suggestion 😉 ?



    1. AFAIK, Not all minor upgrades require a database conversion. At least it was like this in the old NAV days. It could be that you can just skip that step 🙂


  3. Please note that in the script (line 49/50/51) the /de/ is specific for germany. This should be changed to your country

    Is it possible to do the same with external databases. I think you are using an database inside the container;


    1. Did you re-run your scripts . I tried this step by step, but i get the same error as in the video on publishing the first app again that the version already exists. And also have a crash when trying to publish the 3thrd.
      I like the idea


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: