Adding Dyn365FO ISV license file(s) to generated package during Azure DevOps build

In this post I want to share a solution with you on how to add Microsoft Dynamics 365 for Finance and Operation ISV license file(s) to the generated package during Azure DevOps build. The result/goal of this solution is to include the ISV license file(s) in any generated package from during Azure DevOps build. If you want to learn more about ISV licensing please refer to the following docs site: https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/dev-tools/isv-licensing

One reason for including all ISV license file(s) in any generated package is the recently announced Upcoming changes to the servicing flows triggered through Lifecycle Services (LCS). The important part in the linked post is that you have to provide a single package containing all customizations and ISV solutions. 

The “inspiration” for this post is a script from Valery Moskalenko which has been posted on Yammer and also shared on GitHub. My solution is slightly different because I wanted to also use source control to store the ISV license file(s). 

Add ISV license file(s) to source control

First you have to add all your ISV license file(s) to source control, which will result in a structure like this:

Es wurde kein Alt-Text für dieses Bild angegeben.

I´ve add the files to the folder $/BranchPath/Tools/License in my current branch.

Add PowerShell-Task to create License folder in BuildDirectory

The second step is to add a PowerShell-Task to your build pipeline which will create a License folder in the current BuildDirectory. The task should be of type inline and located after the task “Generate Packages” with the following source code:

[string]$LicensePathBuildDirectory = “$(Agent.BuildDirectory)\LicenseTemp”

$LicenseTemp = Join-Path -Path $LicensePathBuildDirectory -ChildPath “AOSService”

$LicensePath = Join-Path -Path $LicenseTemp -ChildPath “Scripts\License”

Write-Host “Creating License folder in BuildDirectory” -ForegroundColor Yellow

New-Item -Path $LicensePathBuildDirectory -ItemType Directory -Force

New-Item -Path $LicensePath -ItemType Directory -Force

Add Copy Files-Task to copy ISV license file(s) from source control to License folder in BuildDirectory

The next step is to add a Copy Files-Task to your build pipeline which will copy ISV license file(s) from source control to the previous created License folder in BuildDirectory. The parameter Source Folder should include the previous created folder to store the license file(s) in source control e.g. $/BranchPath/Tools/License and the parameter Target Folder should include the created License folder in BuildDirectory e.g. $(Agent.BuildDirectory)\LicenseTemp\AOSService\Scripts\License.

After adding and configuring the task it should look like this:

Es wurde kein Alt-Text für dieses Bild angegeben.

Add PowerShell-Task to add ISV license file(s) from License folder in BuildDirectory to generated package

The last step is to add a PowerShell-Task to your build pipeline which will add ISV license file(s) from License folder in BuildDirectory to the generated package. The task should be of type inline and located after the previous created Copy Files-Task with the following source code:

[string]$DPFile = “$(Agent.BuildDirectory)\Packages\AXDeployableRuntime*.zip”

[string]$LicensePathBuildDirectory = “$(Agent.BuildDirectory)\LicenseTemp”

$LicenseTemp = Join-Path -Path $LicensePathBuildDirectory -ChildPath “AOSService”

$LicensePath = Join-Path -Path $LicenseTemp -ChildPath “Scripts\License”

foreach($zipFile in Get-ChildItem -Path $DPFile)

{

    [string]$zipFileFullName = $zipFile.FullName

    Write-Host “Working on” $zipFileFullName -ForegroundColor Yellow

    C:\DynamicsTools\7za.exe a -r -y -mx3 -bb3 “$zipFileFullName” “$LicenseTemp”

}

After you have completed all steps your build pipeline should look like this and you are ready to queue a new build:

Es wurde kein Alt-Text für dieses Bild angegeben.

Leave a Reply

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

WordPress.com Logo

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

Google photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s