As soon as I started working with Containers, more specifically with Azure Containers, around mid-December 2018, I quickly run into a few questions: how can I automate the container creation, how can I update a container (scale up or down, override settings)? How can I scale out my configuration? For some of my questions I identified answers, for others the research is ongoing.

As we established I am not exactly an expert and if you’re still here, the process of generating your first Azure Container loaded with Business Central is a fairly easy one. Check my previous blog where I described step by step the process.

I like to mess around, and I did mess around with the tables where the extensions are managed (system tables 2000000150 NAV App*) ending up with a corrupt container, or rather with a corrupt Business Central. Because I did not have any important data I could just delete the container and run through the steps of manually creating it again. But what if I wanted to automate the process? What if I needed to build 5 distinct containers? How can I speed up the process and make it scalable?

Instead of going through last blog exercise, to delete the corrupt container and re-create it, I decided to investigate Microsoft documentation around deployment templates and deployment parameter files.

This is what I learnt:

In the portal, go to the container created in the previous blog, click on “Automated script” and download:

deploy template

Download the automatic script into a new Visual Studio Code folder. I chose to save it as azuredeploy.json.

vscode-build automated script

Above, is the deployment template I’m going to work with to automate the creation of new containers loaded with a Business Central image. The current image, Microsoft/bcsandbox:latest, in the template code, won’t have data. If you want sample data in your new container(s) use this image: Microsoft/bcsandbox:base. If you need more info about loading your Business Central with data, read Waldo’s and Roberto’s blogs.

image with dataAdditionally, create a new file(the script) – I named it templatedeploy.ps1:


Before we run this script we have to take a closer look at the deployment template downloaded from the portal.

template param section

I replaced the highlighted section above with this one below:

my params

I’m adding 3 new parameters, but you could parametrize almost any setting in your  deployment template and create placeholders for them in the deployment template:


Moreover, I needed to create a new file in our project, parameters.json:


Before running the script “az group deployment create” looks like this:


Now I’m ready to run the powershell script:


To be able to log in Business Central we need the credentials for admin which can be obtained with the command:

az container logs -g rg-template -n d365bc-container-fromtemplate

To perform some cleanup (remove resource group and its content)  run:

az group delete -n rg-template –yes

Let’s now scale out our deployment to 2 containers:


And after running “templatedeploy.ps1” we go to Azure Portal and we can see 2 containers under our unique deployment:


Check the logs, identify the Admin password and you’re ready to login in your container!

That’s what I learnt. What would you add?