web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Blogs / Blogs by Ciprian / Optimizing ALM for Dynamics...

Optimizing ALM for Dynamics 365 with DevOps Pipelines and Deployment Settings

Ciprian  P Profile Picture Ciprian P 44

DevOps pipelines are crucial for implementing Application Lifecycle Management (ALM) in Dynamics 365 projects. They facilitate the transportation of solutions across different environments. However, certain challenges may arise during deployment.

For instance, if a solution includes a Connection Reference that points to an invalid Connection component ID in the target system, the associated Cloud Flows will be deactivated upon import. You can read more about resolving this issue in one of my posts: Resolving Deactivated Cloud Flows in D365 Power Automate ALM: A DevOps Pipeline

The deployment process may involve remapping Connection References, updating Environment Variables, or sharing Canvas Apps with predefined Azure Security Groups. To address these scenarios, the pipeline can update solution files to align with the target environment. This can be achieved using XML transformation tools, although this process can be complex and time-consuming. Alternatively, PowerShell scripts can be executed in the pipelines post-deployment to modify the imported components with the correct links and values.

Fortunately, Microsoft offers a dedicated mechanism that can be configured within the Power Platform Build Tools. For more details, refer to the official documentation: https://learn.microsoft.com/en-us/power-platform/alm/conn-ref-env-variables-build-tools

The Deployment Settings file can also be generated from a solution using the Power Platform CLI:

C:\> pac solution create-settings --solution-zip <solution_zip_file_path> --settings-file <settings_file_name>

To use this mechanism, we start by creating the Deployment Settings file. This file contains a JSON structure that defines the components to be updated with the required values for each target environment. Using the generated Deployment Settings file, the following components can be adapted to match the target environments:

  • Connection IDs for Connection References
  • Environment Variable Values
  • Security Groups for sharing Canvas Apps
  • Workflow Owners

For example, let’s imagine we need to set all Connection References to use a single Dataverse Connection in the target system. Since Connections are not solution-aware and cannot be deployed, simply deploying the solution via DevOps pipelines would result in the Connection References pointing to the Connections defined in the development environment (DEV). However, we can configure the deployment pipelines to adapt the Connection References upon deployment with the correct Connection IDs from the target environment.

We start by exporting the solution and using the Power Platform CLI to generate a sample Deployment Settings file.

Article content

Fig. 1 CLI Generated Deployment Settings

From the sample file, we notice that the solution contains a connection reference for the Dataverse Connector with an empty Connector ID value.

In the target system, the Dataverse Connection ID can be retrieved by navigating to https://make.powerapps.com and opening the existing Dataverse Connection details or creating a new connection.

Article content

Fig. 2 Dataverse Connection ID

The Dataverse Connection ID will be used to fill the “ConnectionId” in the Deployment Settings file.

Article content

Fig. 3 Updated Deployment Settings File

A good approach is to create a Deployment Settings file within a structured folder that represents the target environment. This organization will simplify the configuration of deployment pipelines.

Article content

Fig. 4 Deployment Settings File Definition

With the Deployment Settings file defined, the next step is to include this file in the deployment pipeline. Since deployment pipelines utilize artifacts generated in the build pipelines, a practical solution is to add the Deployment Settings file to the build pipeline artifact. This can be accomplished using the “Copy File” task.

Article content

Fig. 5 Selecting Copy Files Task

This task will be configured to copy the entire “Settings” folder defined in the repository, including the Deployment Settings files for all target environments.

$(Build.ArtifactStagingDirectory)\settings

Article content

Fig. 6 Configuring Copy File Task

After configuring the “Copy Files” task, the artifact generated by the build pipelines will include the settings folder. This folder can then be processed by the release pipelines.

The release pipelines utilize the Power Platform Import Solution task, which allows for the configuration of the Deployment Settings file.

$(System.DefaultWorkingDirectory)/Build/drop/settings/$(envConfigFolder)/deploymentSettings.json

Article contentFig. 7 Power Platform Solution Import Configuration

The configuration described above is making use of “Task Groups”, allowing dynamic configuring of the path to the relevant setting file using variables.

Article content

Fig. 8 Task Group Configuration

The release pipelines are now configured to use the provided Deployment Settings files.

code snippet widget



Comments