“How-to” use the restored Business Central SaaS database on On-premise environment – Part II
Some have written to me about the possibility of using the Business Central SaaS database restored on SQL Server in a Business Central On-premise environment.
In my old post I actually illustrated how to back up the SaaS db so you can save it on Azure Services and download it for restoration on the local SQL Server. In fact, the aim is precisely to be able to download a copy of the SaaS DB, not to be able to use it on a local BC On-premise environment or in Azure subscription.
Actually, however, it should be possible to use it, I found some workarounds to do it. I know it is not an excellent recovery, as it is not complete (there are no installed apps and updated system apps) but it can be useful to be able to immediately navigate the data through the Business Central Web Client).
RESTORE of a SAAS DB on ON-PREMISE BC 15.2 – STEP BY STEP
#1 – PRE-REQUIREMENTS
Download the backup copy of the SaaS database .
Restore the downloaded database in “bacpac” format on your local SQL Server.
Follow this my old post to achieve these two goals: https://robertostefanettinavblog.com/2019/11/07/business-central-saas-exporting-database-backup-and-restore-it-on-your-sql-server/
Download the on-premise version equivalent to that of the downloaded bacpac (in this case v15.2)
VERY IMPORTANT: as the use in both single and multi-tenant requires the same platform version!
Version > BACKUP PRODUCTION DB > Production v15.2.39060.0 ITA
Business Central, Production, Active, IT 15.2.39060.0
#2 – DOWNLOAD DVD RELEASE FOR BUSINESS CENTRAL ON-PREMISE
Download the Business Central On-premise DVD
In this case, you need this release: “Update 15.2 for Microsoft Dynamics 365 Business Central 2019 Release Wave 2 (Application Build 15.2.39040, Platform Build 15.2.38951)”
RESTORE THE SAAS DATABASE
INSTALL BC ONPREMISE WITH DEMO DATABASE
In this case: Demo Database BC (15-0) ITA
#3 – SCENARIO (SAAS to ONPREMISE)
It is possible to restore DB SaaS to DB Onpremise in two ways
- Single tenant
The easiest and fastest is the single tenant
it is possible to load the data present in the SaaS db using the base and the system app of version 15 without restoring the installed apps or perform the whole process to install the correct base and system app by downloading the exact build of the Cloud installation (you need to search for that build as a CD upgrade or via docker).
It is necessary to manually change some parameters on SQL Server (e.g. Db Collation, version of the platform and of the installed system apps otherwise you cannot use)
In the backup of the SaaS db there are also the APPs installed and published, since it is not possible to unmount them before the backup: either I delete them from Sql or I install them first in the app base of the Onpremise db, otherwise the system reports errors.
#4 – POWERSHELL SCRIPTS – “HOW-TO”
With this script, it is possible to configure the Business Central Server BC150 to connect it to the Restored SaaS db, in this case for single-tenant.
POWERSHELL SCRIPT EXAMPLE
Source Powershell Script – Single Tenant link
CHANGE THE SQL SERVER COLLACTION ON Demo Database BC like the SaaS DB
CHANGE SOME PARAMETERS
Table $ndo$tenantproperty, $ndo$tenantdatabaseversion, $ndo$tenantdatabaseproperty
CHECK INSTALLED APPS \ NAV APP (BC DEMO e SAAS DB)
- Change Versions for Microsoft Apps, Remove the custom installed APPS
DELETE APPS ON BCDEMO
OR DELETE USING SQL SCRIPTS
CREATE AND ASSIGN USER FOR ADMIN LOGIN
DELETE ROLES FROM ACCESS CONTROL (SAAS DB)
- Remove Published Apps
- Change SQL Collaction
#5 – BINGO! YOUR BC ONPREMISE IS READY!
Restart BC DEMO (BC150) SERVER
Now your instance is connected to restored SaaS DB! ….after you can publish and install your extensions.
YOU ARE WELCOME!
Thanks to Duilio Tacconi (Microsoft Escalation Engineer) for support and advices! always available!