Azure DevOps tasks for Microsoft Dynamics 365 for Finance and Operations – Part 1

Azure DevOps Pipelines is a cloud service that you can use to automatically build, test and deploy your code to (m)any environments. Since Apr 2019 you can use new Azure DevOps tasks for Microsoft Dynamics 365 to upload and deploy your application deployable package to LCS environments. This blog describes how to set up Azure DevOps to build and deploy code for Microsoft Dynamics 365 to LCS environment.

Prerequisites

There are a few things that must be in place before you can start.

  1. Configure your LCS project to link with Azure DevOps (Visual Studio Team Services)

https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/lifecycle-services/support-experience

  1. Install the Dynamics 365 Unified Operations Tools into your Azure DevOps from Visual Studio Marketplace

https://marketplace.visualstudio.com/items?itemName=Dyn365FinOps.dynamics365-finops-tools

  1. Have access to Azure AAD administration for your organization with enough permissions to register a new application

https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app

  1. Have a user account with username and password and enough permissions in your LCS project. It won’t work with a user that has the multi-factor authentication enabled.

Enable the build system

To enable the build system, you will need a dedicated build agent and a build agent pool for your LCS project. Detailed info how to set up build and test environment can be found here https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/perf-test/continuous-build-test-automation

Build Agent Pool Setup

An agent pool organizes your build agents into a logical collection. The agent pool can be assigned to one or more Azure DevOps Pipelines across your organization. For our purpose, we consider having at minimum one agent pool for LCS project. Find more about agent pools here https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/pools-queues?view=azure-devops

To create a new Agent Pool, go to Organization Settings in your Azure DevOps and select Agent pools from Pipelines group. Click on “New agent pool…” button and give it a name

 

 

Build Agent Setup

As part of the LCS deployment to Microsoft-hosted environment, you can configure a Build Agent properties. This link describes how to deploy a cloud development environment https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/dev-tools/access-instances

As a part of the deployment process, you can configure your build agent name and name of the agent pool that will be this agent owner. The agent pool must exist prior to deployment or the deployment will fail. By default, the “Default” agent pool is used.

 

After successful deployment, a new agent will be added to the selected agent pool.

 

Build Pipeline

Now you can navigate to your Azure DevOps project linked with your LCS project and configure the build pipeline.  First, you will find there a single pipeline named “Unified Operations platform – Build Main”. I would recommend keeping this pipeline as a template and create your customized pipelines by cloning it.

Setup Build Pipeline

Select your pipeline and click “Edit”. Default build pipeline will consist of many steps. I will just walk through the most important. As a first step, you give your pipeline a proper name and select the agent pool you created in the previous step.

 

Then, you can map source code folders you want to include in the build and cloak the ones you want to exclude. Optionally select Clean options and whether you want to apply Label in your selected Azure repository branch. To distinguish between Labels, you can leverage various built-in variables or create your own. I will talk about variables later.

 

 

These were the basic steps and now you can test your build pipeline. If needed, you can adjust build parameters and finally queue a new build.

 

 

As a result of a successful build, build artifacts are published in your pipeline. Build artifacts are the files produced by your build, e.g. application deployable package. You can download artifacts produced by your build from an instance of the successfully completed build.

 

 

Thank you for your time to read this. In part 2, I will discuss how to deploy a build artifact to selected LCS environment.

Share this within your company!