The ARM Templates now supports artifacts… (and images)

Update 2021/2/10: BcContainerHelper has replaced NavContainerHelper. This blog post still reference NavContainerHelper, which is outdated.

I know a lot of partners and customers are using the Business Central ARM templates to create an Azure VM, which runs a specific version of Business Central (or NAV). This blog post describes what changed.

Images still supported

First of all, the ARM templates still supports docker images. This means that if you are provisioning Azure VMs using the ARM templates through a PowerShell script, that script should still run.

By default, the artifactUrl is specified to return the latest version and the docker image setting is blank. If you however specify a docker image in the template, it will ignore the artifactUrl setting (hence allowing your script to still run).

The ARM template short URLs

There are currently 6 short Urls for creating Azure VMs with Business Central or NAV. In all templates you can replace the artifactUrl to a different artifact, but by default, the shortUrls will give you the following:

http://aka.ms/getbcCreates an Azure VM with the latest on-premises W1 build of Business Central (simplified template)
http://aka.ms/getbcextCreates an Azure VM with the latest on-premises W1 build of Business Central (extended template)
http://aka.ms/getnavCreates an Azure VM with the latest W1 build of NAV (simplified template)
http://aka.ms/getnavextCreates an Azure VM with the latest W1 build of NAV (extended template)
http://aka.ms/bcsandboxazureCreates an Azure VM with the latest US build of Business Central (sandbox)
http://aka.ms/getnavworkshopvmsCreates a number of Azure VMs with the latest US build of Business Central (sandbox)

As a special option, you can add the number 2 to all Urls to get an insider version (the dev branch). While writing this blog post, the 2 branches are identical and I recommend that you use the Urls above.

The ArtifactUrl setting

When you launch any of those short Urls, you will be asked to login to the your Azure Subscription (i.e. the subscription which pays the cost of your Azure VM). After this, you will see a template, which you need to fill out. see this blog post for more general information about this: https://freddysblog.com/2019/07/26/the-arm-templates-for-dynamics-365-business-central-and-microsoft-dynamics-nav/

The only new field is artifactUrl and it is defaulted as described under Get-BcArtifactUrl in this blog post: https://freddysblog.com/2020/06/27/ci-cd-and-artifacts/

Again – if you enter a docker image, the artifactUrl is ignored. You can either enter a full artifact Url (returned by Get-BcArtifactUrl) or you can enter the parameters for the function (like above) separated by a slash like:

storageAccount/type/version/country/select/sasToken

This means that this value:

https://bcartifacts.azureedge.net/onprem/14.9.39327.0/dk

and this:

bcartifacts/onprem/14.9.39327.0/dk

Yields the same Business Central version (but you probably already guessed that)

Internally

If you login to the Azure VM to see what is going on, you will discover that the ContainerHelper is using the mode, where is generates the image and saves it locally on the machine before running it:

The image is named mybc:<version>-<country>

The github repository

All the ARM templates are open source and you are very welcome to clone and change them for your own needs. The github repository is here: https://github.com/microsoft/nav-arm-templates.

The short Urls are calling an Azure Function to embed parameters into the template. You can reuse that, or you can create a direct Url to deploy your template. You will need a URL to your template json file, like:

https://raw.githubusercontent.com/microsoft/nav-arm-templates/master/getbc.json

You need to data string encode this url and append it to https://portal.azure.com/#create/Microsoft.Template/uri/ – then you will have a direct URL, that launches your template:

https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fmicrosoft%2Fnav-arm-templates%2Fmaster%2Fgetbc.json

You can also use the azure function, which also is used by the short urls:

https://freddyk.azurewebsites.net/api/deploy?template=https%3A%2F%2Fraw.githubusercontent.com%2Fmicrosoft%2Fnav-arm-templates%2Fmaster%2Fgetbc.json

This offers the advantage to specify parameters and build out a string, which can deploy exactly the Azure VM you need (example setting the VmName)

https://freddyk.azurewebsites.net/api/deploy?template=https%3A%2F%2Fraw.githubusercontent.com%2Fmicrosoft%2Fnav-arm-templates%2Fmaster%2Fgetbc.json&vmName=myamazingvm

You get the picture…

Enjoy

Freddy Kristiansen
Technical Evangelist

8 thoughts on “The ARM Templates now supports artifacts… (and images)

  1. Freddy, perhaps a stupid question from me, I’m using this for my development and that works great, but if I read correctly we can use this also to roll-out a specific Azure VM, using MFA, SSO voor a D365 BC Production instance in a specific version and specific localisation? Or do you advise not to use this for production sites. It seems to create an Azure VM and a container running at that VM or am I wrong.

    Second how can we then map the certificates and for instance the domainname
    .easystep2.cloud(\bc\) using the ARMtemplates?

    Third, would it not be great if we can also point to an additional script which is upgrading an existing Azure SQL database and connect it to the created new Azure VM.

    Like

  2. Hi Freddy,

    Great article! A few questions for you:

    1) Is there any way to connect one of these sample BC VMs to an existing SQL Server VM? Or if not, are there plans to do this?
    2) How would you go about running extra scripts at the end of your template? I need to to create extra users with specific rights once the VM has been setup. Is there any way to add script to be run at the end of your ARM template? Right now, I’m stuck running extra PS scripts on the VM once everything else is finished.

    Anyway, thanks again!

    Like

    • 1. No plans of doing that automatically, but the ARM templates are open source and you could just clone and add things.
      2. There is a parameter called Final Setup Script Url – in that you can place a URL to a .ps1 script, which will be executed when everything else is done.

      Like

Leave a comment