Add Licenses During the Build Pipeline or Release Process |
Background
In this post, I will be focusing on the Add Licenses to Deployable Package Task, which is the second of the new tasks I have had the opportunity to try out. To read about the Create Deployable Package Task, take a look at my previous post;
Microsoft have released 3 new Azure DevOps tasks to support the upcoming preview of Azure DevOps hosted builds, which will enable building without a dedicated server hosting the build agent.
The tasks are;
- Create Deployable Package
- Add Licenses to Deployable Package
- Update Model Version
Add tasks from Dynamics 365 Finance and Operations Tools |
Information about all 3 new tasks has been posted on release by Microsoft's Joris de Gruyter here;
Add Licenses to Deployable Package Task
As with the new Create Deployable Packages Task, the Add Licenses to Deployable Package Task brings immediate benefits. Rather than install our ISV Licenses in a seperate deployable package to the application, we can add them to the application deployable package as part of the Build or Release Pipeline.
For this example we will modify an existing build definition.
If you have already setup a release pipeline from any of my previous posts, the latest Tasks will already be installed on your Azure DevOps instance as part of Dynamics 365 Finance and Operations Tools, so I won't cover installing them, and assume they are already there.
If you are looking for how to install Dynamics 365 Finance and Operations Tools on your Azure DevOps instance, or how to set up an Azure DevOps Release Pipeline, then start here;
Azure DevOps Release Pipeline for Dyn365FO - Part 2: Scheduled Releases with Approvals
Browse to Pipelines then Builds in Azure DevOps.
At this stage I almost always click on the 3 dots in the top right and Clone the build definition before going any further.
Click on Edit on your original or cloned build definition.
Browse to Pipelines then Builds in Azure DevOps.
Azure DevOps Pipelines |
At this stage I almost always click on the 3 dots in the top right and Clone the build definition before going any further.
Clone a build definition |
Click on Edit on your original or cloned build definition.
With the build pipeline open for editing, browse the task Publish Artifact: Packages.
Click the + at the top of the build phase to add a new task;
Search for Add Licenses to Deployable package, and add the task below.
Add task to Build Phase |
Add Licenses to Deployable Package Task |
We need to place the task to include the licenses just before publish. Drag the task to position it directly before Publish Artifact: Packages. In the example build definition I am modifying here, the task before is Copy Files to: Staging Directory.
There are 3 properties to set. Name can be anything.
Search pattern for license file to add to package is where we specify were to pick up the license text files.
I created a folder on the Service Drive of the Build box (likely to be K:) called licenses. In there I dropped 2 license files.
Then set the search pattern to look in that location for any files, using *.
Add Licenses to Deployable Package - Parameters |
The filename and path of the deployable package should be set to one of the following examples. If your pipeline uses the old poweshell task for creating your deployable package;
$(Build.ArtifactStagingDirectory)\Packages\AXDeployableRuntime_7.0.5286.35426_$(Build.BuildNumber).zip
The filename in this case still needs to have the platform build number.
If you have moved to using the new Create Deployable Package Task, you can use the following;
$(Build.ArtifactStagingDirectory)\Packages\AXDeployableRuntime_$(Build.BuildNumber).zip
Using this method, the platform build number is no longer part of the package name.
Add Licenses to Deployable Package - Parameters |
...that's the new Task setup complete. Run the build pipeline and get an output from the Add Licenses to Deployable Package task.
Add License to Deployable Package Output |
To give feedback or ask questions please leave a comment here, or tweet me @AnthonyBlakeDev
This comment has been removed by the author.
ReplyDeletei did the same setup but while running the add license to deployable package step it got failed with error as "Leaf path not found: 'C:\DynamicsSDK\VSOAgent\_work\9\a\AXDeployableRuntime_2020.8.19.2.zip' ".
ReplyDeletecheck the position of your add license step. the error is suggesting that the step cannot find the package to add licenses to, so a previous step must have not created the package or put it in that location.
DeleteHi YDRao,
DeleteWere you able to resolve the issue? I received the same error although the previous steps were all successful.
Thanks.
Hi Anthony, thanks for sharing. Since RDP is going to be moved from Tier 1 Build environments, do you have another solution instead of copying the license files to the service drive of the Build?
ReplyDeletehey Robert, if you are still using tier 1 build environments you should really me migrating those over to cloud hosted boxes as they are due to be decommissioned very soon. However this is still relevant for using the ADO hosted build agent. I need to write it up as a post, but my thoughts are we could drop the license into a location in the source repo, then copy it into a folder to be added to the package as part of the build process.
Delete