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


Unknown said…
Hi Olister,

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

Hi Mohammed,
You can refer here
SD said…
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.
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.
SD said…
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.


Popular posts from this blog

Understanding and How to use APIs Business Central - 2

Introduction: In my last blog post ( Business Central API -1 ) on Creating API in Business Central, we discussed all the commonly used properties of the page, query, and controls like field and data-item. In today's blog, we will be diving deeply into the validation of the data passed through the API endpoint, how it enters into the source tables and is manipulated to be inserted/modified into single or multiple tables. Also, I will be demonstrating how APIs are to be used. Pre-requisites: Microsoft Dynamics Business Central (SaaS) VS Code( ) AL Language Extension( ) API V1 from Business Central On-Premise DVD Books & References: API V1 from Business Central On-Premise DVD API(V1.0) for Business Central ( Click Here ) API(Beta) for Business Central ( Click Here ) Theory: Understanding API in Business Central 1. BINDSUBSCRIPTIONS: Use to trigger IntegrationEvent for the Codeunit stated

Enum Object in Business Central - How to create and how to extend!

Introduction: Since the dawn of Business Central Era (2nd April 2018 - Today), there are many new data types introduced by Microsoft. One such data type is Enum(Enumeration). Essentially, what enumeration is having a single select value with multiple options at a given time! Well, I know what your thinking what about the 'Option' data type. Anyways, enough of talking let's just dive in! Disclaimer:   The knowledge in this blog is true and complete to the best of authors and publishers knowledge. The author and publisher disclaim any liability in connection with the use of this information. Pre-requisites: Microsoft Dynamics Business Central (SaaS or On-Premise) VS code with AL Language extension Code: 1. Enum as an Object: Just like Tables and Pages, Enum behaves like an Object. Enum Object Note that Extensible means that the Enum Object can be extended in another module. By default, this property is set to TRUE. Enums created in a module(App), ca

Creating APIs in Business Central - 1

Introduction: While writing a blog on Automated Testing in Business Central, I was going through sample apps provided by Microsoft and realized that the complexity is nowhere close to what examples Microsoft has provided on In this blog, I will try to explain how APIs work and how to be creative with the implementation. Also, an API which were in beta are finally out with version V1.0 in the April 2019 release let's see some important key things from development aspects. This blog is going to be theoretical one kindly bear with me. Pre-requisites: Microsoft Dynamics Business Central (SaaS) VS Code( ) AL Language Extension( ) API V1 from Business Central On-Premise DVD Books & References: API V1 from Business Central On-Premise DVD API(V1.0) for Business Central ( Click Here ) API(Beta) for Business Central ( Click Here ) Solution: Key Requirements: API source table