Few weeks ago I was preparing our Azure hosted environment and I wanted to:
1) Have BC OnPrem installed on VPC in Azure
2) Using multitenant environment using Azure Database
Ok, easy task. Creating VPC in azure, uploading install DVD, running install.
When filling up the configuration parameters, you need to enter SQL server address and database name. The plan was to install Cronus DB to azure and later transform it to multitenant App DB and Tenant DB. Thus I filled in the Azure SQL address and selected DB name. Install...
After some time, installer failed.
Ok, I thought that the problem is that it cannot restore DB from bak file. Solution: restore the DB locally (removing the windows users, removing deadlock monitorig), creating bacpac, uploading to azure, creating the database from it. Repeat the installation with existing database.
With existing DB I expected that I will go further, but still, at the end, it failed. It failed to install Service Tier. Looking into Event log I found that it cannot authenticate to the Azure DB - and the reason is clear - windows authentication is not supported. I need to enter the DB credentials somewhere. But there is no choice for that in the install dialog!
Ok, what about installing the Service tier and enter the DB credentials later? No way, because the installation will fail (and rollback the Service Tier installation) when the Service Tier cannot be started at the end of the process.
Hmm, what about entering the DB authentication during the install, after all is installed and the install process is trying to start the service tier? Tried that, was able to enter the db credentials, but still, the install process failed, even when I was able to start the service tier manually. I assume that the install process received error code and is not checking that the service is running at the end because someone else started it correctly. Thus leading to Service Tier uninstallation again.
Time to read documentation: https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/deployment/deploy-database-azure-sql-database
Based on the documentation, I should prepare the Azure DB (ok, done), and than configure the service tier. Ok, Problem is, that whole doc is expecting that there is local SQL for the DB. I do not want to have any SQL on my VPC! I want to have as much clean VPC as possible! Hey, I really want to setup the DB authentication on the service tier, but I cannot because I do not have the service tier at all, because I cannot install it until I have some DB with windows authentication.
This is deadlock for me - cannot setup DB authentication because I do not have Service tier, and I do not have Service tier because I cannot setup DB authentication!
Lucky I have some experience with installations and MSI files and I expect that there is setting that the installed service should be started as part of the installation. What if I turned this off?
Looked for MSI editor and found one I used long, long, long time ago - ORCA.
Start the editor, open the MSI for Business Central Server and go to section ServiceControl. There is entry with ServiceControl = StartOnInstall, where Event = 1. Checking doc for this table explains that Event 1 means "msidbServiceControlEventStart". Hmmm, looks promising. What to set instead? In doc there is value 4, described as "(none)". Looks good. Set the 4 instead 1, save the file.
After this small change, I am running the install again, and, result is, that the Service tier is INSTALLED even when it cannot be started!
Great! Now I can set the database authentication, set my Azure database, create multitenant... and continue with the work.
I hope that this could help someone solving same problem when going to the cloud. Please, be warned! You are tempering install files on our own responsibility! Official way is to install the service tier with some Non-Azure SQL server available (e.g. local SQL express). I was doing that just because I wanted to not install SQL on my VPC and because I am hard-headed :-)