Skip to main content

CI/CD in NAV / Business Central Development using Azure DevOps


Azure DevOps is a very handy tool to manage project tasks, milestones, bugs, and documentation.
But it is not just limited to that, it can also be used to manage all your deployments and building pipelines to manage your deployments.
Lets take a look how to do this and how we can setup our repository to make auto deployments.


  • VS Code
  • Microsoft Dynamics NAV / Business Central
  • Azure DevOps Subscription
  • Understanding of  Version Source Control System like Github or TFS
  • Understanding of PowerShell

Books & References:


1. Creation of Azure DevOps Repository: Creation of Azure DevOps Repository is the starting point of the every code related activities in any projects. Azure DevOps Repository is one of the source control application from multiple application  such as TFS(VSTS) and GitHub.
Importing a Git Repository from AL Ops Template
Repository Created in Azure DevOps

2. Cloning Repository in VS Code:
After creating repository in Azure DevOps, the project is to be cloned to local project in the PC. Thus, after the cloning is done, you can create your project files which can then be synced to remote repository created on Azure DevOps.
Creation of Local Repository in VS Code

3. Creation of PowerShell script for auto compilation and deployment:
i. Copying the Compiler from VS Code existing extension compiler:
In order to compile the Business Central Project on the Windows machine, you require a compiler. Now, if the deployment has to happen automatically on random machine auto-created by Azure Pipelines, you also need to copy the Compiler from your Local Machine to your Remote Project folder. From there there the Compiler can be referenced and used to compile on the Remote Machine created.  

By Default the ALC (AL Compiler) is stored on path
In this case, I have copied this to the project folder like this

ii. Creating PowerShell to Compile the project based upon the objects created and  Symbols: Using the ALC, you can now compile the Project and Symbols as parameters.
The syntax for the project to compile is :
<Path to ALC>  /project:<PROJECT FOLDER PATH>  /out:<APP OUTPUT PATH> /packagecachepath:<PROJECT FOLDER PATH>\.AlPackages

AL Compile Syntax
iii. Creating PowerShell command to deploy the App File created to  Business Central using APIs: Whenever you hit Ctrl + F5 in VS Code, the VS Code actually calls the APIs in a PUT method to with the parameter as the .App File created after the compilation of the Business Central Project. Well even I'm going to do the same thing.
In terms of Authentication, I will be calling my APIs using Basic authentication which is Username and Webservice key defined in Users Page. Overall, I did it with the help of PowerShell below.
Deploy Business Central App using PowerShell

Thank you @FreddyK( for providing me the reference material to call the Business Central APIs for App Development (

4. Creation of Azure Pipelines YAML: After all this has been set, now it is time to automate the procedure. Basically, I want the system to work as whenever I Commit and Push my code into Azure DevOps Repository, The Azure Pipelines will pickup from the Commit, Compile the project and Deploy it to Business Central using the PowerShell Script called above.
These auto deployments are done with the help of YAML files below.  
YAML File to automate the deployments
YAML files consists of set of Tasks, Scripts and Configurations used by Azure Pipelines to spin-up a temporary Virtual Machines and Run all the Codes configured in the YAML files.

5. Output:
Whenever I commited my code to Azure DevOps, a following screen is seen.
Code Commits with Azure Pipelines Status

A command line window appears showing the processing of the PowerShell Script called through the YAML Task.
Execution of Azure Pipelines and PowerShell Task.
Finally, after the code is deployed to Business Central you will get the following Output.
Business Central Output after the code is deployed!

As you can see you can use this process for each of the code commits that happen ensuring that the code is deployed correctly. This can also be configured for each of the branch of repository and every developer can auto deploy it to their specific tenants.

Also, ALOps is one of the best tool to automate your Business Central deployments. Blog on that topic will follow soon.

Thank you for reading this! Hope this helps


  1. Hi Olister,

    Very good and informative article on CI/CD topic, do you have sample files on github for the article?


  2. Hi Mohammed,
    You can refer here

  3. Hi Olister,

    I am trying to replicate the same scenario but getting error while try to compile the app

    Getting error

    Version : 2.165.0
    Author : Microsoft Corporation
    Help :
    Generating script.
    Formatted command: . 'd:\a\1\s\CICDProject\Compile-PS.ps1'
    ========================== Starting Command Output ===========================
    "C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'd:\a\_temp\ed8ad533-b3c9-431f-8cb9-875c25e6cf13.ps1'"
    .\CICDProject\ALCompiler\alc.exe/project:.\CICDProject/out:.\CICDProject\\AlPackages :
    The term
    is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name,
    or if a path was included, verify that the path is correct and try again.
    At D:\a\1\s\CICDProject\Compile-PS.ps1:3 char:1
    + .\CICDProject\ALCompiler\alc.exe/project:.\CICDProject/out:.\CICDProj ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (.\CICDProject\\AlPackages:String) [], ParentContainsErrorRecord
    + FullyQualifiedErrorId : CommandNotFoundException

    ##[error]PowerShell exited with code '1'.
    Finishing: Compile the App

    Could you please suggest how to write the command in Compile.ps1.

  4. Hi SD,

    It looks like you command is not pointing correctly to ALC and its parameters.

    I would recommend that you use everything in the same project folder.
    Also I noticed that there are no spaces to seperate ALC and its parameters.

    Generally you 'cd' into ProjectFolder then you call .\ALCompiler\alc.exe and then the project path is ./ and output path is ./


    I hope this helps.

  5. Hi Olister,
    Thanks for the reply but still i m not able to write the command successfully,
    My command is "Set-location C:\NAGRepo\NAGCICD\CICDProject\ALCompiler > alc.exe /project:C:\NAGRepo\NAGCICD\CICDProject /out:C:\NAGRepo\NAGCICD\CICDProject\ /packagecachepath:C:\NAGRepo\NAGCICD\CICDProject\ALPackages"

    Does the above command work on the Azure?

    I am still getting error in the Azure Pipeline

    Starting: Compile the App
    Task : PowerShell
    Description : Run a PowerShell script on Linux, macOS, or Windows
    Version : 2.165.0
    Author : Microsoft Corporation
    Help :
    Generating script.
    Formatted command: . 'd:\a\1\s\CICDProject\Compile-PS.ps1'
    ========================== Starting Command Output ===========================
    "C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'd:\a\_temp\3b8ca8d4-6ed2-401a-8a5b-0c10b258841a.ps1'"
    Set-Location : Cannot find path 'C:\NAGRepo\NAGCICD\CICDProject\ALCompiler' because it does not exist.
    At D:\a\1\s\CICDProject\Compile-PS.ps1:5 char:1
    + Set-Location C:\NAGRepo\NAGCICD\CICDProject\ALCompiler
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (C:\NAGRepo\NAGC...ject\ALCompiler:String) [Set-Location], ItemNotFoundE
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand

    ##[error]PowerShell exited with code '1'.
    Finishing: Compile the App

    Could you help me to rectify the above.



Post a Comment

Let me know your comments below. I'll try my best to answer your comment

Popular posts from this blog

Something went wrong. An Error occurred - Error Resolution

Introduction: With the installation of NAV 2018 or BC On-premise, I have observed that when creating New Server Instance and New WebServer Instance, you will get the error 'Something went wrong. An Error occurred '. I referred to the community questions below but didn't find my resolution. Hence, I decided to write this blog. Pre-requisites: Microsoft Dynamics Business Central - On-Premise / NAV 2018 Understanding of Business Central Authentication  Books & References: Demonstration: 1. Creation of NAVServerInstance: In order to create NAVServerInstance, you can either add the Server Instance through Business Central Administration or Powershell command. Add Instance - Business Central Administration Add Insta

Universal Code Error and Resolution

Introduction: On Friday, May 12th, 2023, the Business Central On-Premise Production Environments started throwing universal code errors as follows. This occurred to every customer on a lower version of BC 19,20 and 21 irrespective of their localization, customization, and license. Pre-requisites:  Understanding of Technical Upgrade in Business Central On-Prem References: BC20 On prem. Universal Code requirement error after installing customer's license. - Dynamics 365 Business Central Forum Community Forum (40) Yammer : Dynamics 365 Business Central Development : View Conversation Root Cause: The certificate that signs Microsoft Base Application was expired. Errors started occurring if you Uninstalled, Installed Extensions, Restart Server Instances or for some even out of random started popping out. We first thought could be a license issue as we had fixed that before but this did not solve the issue. Resolution: Microsoft identified the issue and posted the following update The mi

How to update your Business Central to Latest CU

Introduction:  There are times when Microsoft releases the latest major version upgrade for Business Central Upgrade and you face many issues with it. As soon as the bugs are reported to Microsoft, they start to fix them and ask you to upgrade to a certain Cumulative Update. In this blog, I will be sharing my experience with Business Central v21 CU0 upgrade to Business Central v21 CU2. Pre-requisites:  Business Central DVD for Latest CU Basic Understanding of Business Central CU Updates Books & References:  List of Update Packages How to Update CU version Demonstration:  1. Check the current state of BC: As part of knowing the current state of your Business Central environment, I'm assuming that your Business Central Environment will have some data in the standard Base App also there will be customization with extended tables and newly created tables. Customization - TableExtension on Customer Table  Customization - Custom Table created Make a note of the data that is present i