CI/CD and artifacts

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

Only a few days have gone since releasing information about how to run Business Central in docker using artifacts and already a lot of people have tried this out and a lot of people are looking into changing their CI/CD pipelines to use artifacts.

On premises / Specific version

If your pipeline is running using an om-premises build or using a specific version of NAV or Business Central, it is really easy. Replace your imagename setting with an artifact setting pointing to the artifact you want to use and change the function creating the container to use this setting as -artifacturl when calling New-BcContainer.

PTE / AppSource App

For PTEs (Per Tenant Extensions) or appsource apps it is a little more complex. You probably have a CI pipeline running either on a specific version or on a docker image which is the latest current build, and then you might have two pipelines testing your app against the next minor insider builds and the next major insider builds and since all artifacts are stored using version number and country how do you determine next minor and next major artifact url.

I thought of a lot of different ways to do this. During the preview phase, I had redirection artifacts which would point out the right artifact and I also tried using a few redirection urls ( In the end the answer was simple.


You should of course use Get-BcArtifactUrl. Yes, I know that the function cannot be used in Yaml, but it can be used in PowerShell and I am going to use New-BcContainer anyway so hey, what’s the problem.

In my BingMaps sample app, I changed the imagename setting to an artifact setting, which is a “/” separated string containing of:


You can use the same – or use other mechanisms, but the goal is to have one string, in which I can specify the parameters to Get-BcArtifactUrl.

My code to get the artifactUrl based on this is then:

$segments = "$artifact////".Split('/')
$artifactUrl = Get-BCArtifactUrl -storageAccount $segments[0] -type $segments[1] -version $segments[2] -country $segments[3] -select $segments[4] -sasToken $env:InsiderSasToken | Select-Object -First 1
if (-not ($artifactUrl)) {
    throw "Unable to locate artifactUrl from $artifact"

This totally allows me to “call” Get-BcArtifactUrl in my pipeline and I can now specify my artifacts to match my needs.

A few samples of artifact settings:

A specific versionbcartifacts/sandbox/16.2.13509.14082/us/Latest
Latest 16.2 sandboxbcartifacts/sandbox/16.2/us/Latest
Latest sandboxbcartifacts/sandbox//us/Latest
Next majorbcinsider/sandbox//us/Latest
Next minorbcinsider/sandbox//us/SecondToLastMajor

BTW – if you need a sasToken for insider builds it is available on – the actual package is here: (which you only can see if you have access to the Ready! for Dynamics 365 Business Central program). The package looks like this:

The BingMaps sample

The BingMaps sample which already have been changed to use artifacts can be found here: I also have an imagename parameter, which I use to allow the pipeline to build the image and reuse that next time.

One very interesting new thing with the BingMaps sample is. that it used the free Azure Hosted agents to run the builds. I do NOT have any build agent setup myself.

Due to the new way of running with artifacts, that is now possible – yes it takes a little longer – but for open source projects it is free. You can read more about Microsoft hosted agents here: (see capabilities and limitations to see what you get for free).

The HelloWorld sample

The Hands On Lab ( and the HelloWorld sample ( will also be updated to use artifacts and Microsoft hosted agents.

Open Source Apps

This actually opens up for something I have been thinking about for a very long time. Open Source Apps. With source code control, devops, pipelines and all free for open source projects – it is now possible to create open source apps, on which people can collaborate and use.

More about this idea at a later time…


Freddy Kristiansen
Technical Evangelist

11 thoughts on “CI/CD and artifacts

  1. Pingback: The ARM Templates now supports artifacts… (and images) | Freddys blog

      • Thanks!

        If I might ask another question: how to retrieve without the file targetted by platformUrl? I have not found it in the artifact itself (makes sense considering it is part of the platform…).

        With this piece, it would give us a way to build an app very quickly (about 2-3 minutes) without loading Docker. It could even run on Microsoft hosted agent and be used for checking PR.


  2. Hi, trying out the new artifacts image build in the CI/CD and am getting an error. It is failing on the step ‘Create Build Container’ build process.

    “Step 5/6 : RUN \Run\start.ps1 -installOnly
    —> Running in 94cbec29a407
    ##[error]docker : hcsshim::CreateComputeSystem 94cbec29a4072f98202b2cd608b575bc5a93697007a44308b276d30065266283: The virtual
    machine could not be started because a required feature is not installed.
    At C:\Program Files\WindowsPowerShell\Modules\navcontainerhelper\\ContainerHandling\New-NavImage.ps1:312 char:1

    I tried with the default settings and got this on my local build agent. Then I tried to change it to the 16.3 artifact name(I verified that the Get-BCArtifactUrl works with 16.3). Both throw the same error.

    Any ideas on how I should proceed?

    navcontainerhelper version:
    latest pull from the hello world repo:
    using local build agent(changed the yaml from azure-pipeline), with all pre-requisites installed
    I also re-followed along the Hands on Lab for CI/CD in case I was missing something. I don’t think I am.


  3. Pingback: Business Central App maintenance policy tightened - Kauffmann @ Dynamics NAV - Dynamics 365 Business Central/NAV User Group - Dynamics User Group

  4. Pingback: Docker Artifacts - theDenSter

  5. Pingback: Business Central App maintenance policy tightened – Kauffmann @ Dynamics 365 Business Central

  6. Hello Freddy, thank you for your valuable tutorials and contributions. I have a question, where do I get this information: InsiderSasToken?


Leave a Reply

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

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

Facebook photo

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

Connecting to %s