Skip to content

Solutions

Peter McDonald edited this page May 16, 2023 · 15 revisions

Dataverse Solutions

This plugin allows for the download, extraction, source control, build, and release of Dataverse solutions using Azure DevOps Pipelines. This utilises spkl by Scott Durrow to perform the solution extraction and deployment.

Table of Contents

Getting Started

Once you have initalised your project you will be able to select one of the following options:

Solution List

Restore Dependencies

This option will restore the local dependencies onto your PC. This is required before you can extract or deploy a solution.

Extract Solution

This option extracts the solution from your Dataverse environment and places it into the solution folder. Extracted solutions will be unpacked, allowing each component to be managed individually. This feature is beneficial for source control and enables the use of tools such as Power Platform Build Tools to build managed solutions. See the section below.

Pack Solution

This option packs the local extracted solution into a zip file and places it into the releases folder. Note: The solution will be packed as an unmanaged solution for import into a development environment.

Deploy Solution

This option installs an unmanaged version of the solution into your Dataverse environment. Note: This operation will overwrite any existing solution with the same name.

Managed Solutions

The creation of managed solutions is done using Azure DevOps Pipelines. The following steps are required to setup the pipeline:

Create a service connection (if required)

To create a service connection, navigate to the project settings and select Service Connections under Pipelines.

Select Power Platform from the list of connection types. If it is not available, you will need to install the Power Platform Build Tools extension from the marketplace.

Enter the details for your dataverse enviroment into the panel and give the service connection a name, DEVENV is the default name used in the azure-piplines template from this extension.

Note if you click "Grant access permission to all pipelines" it will save you from needing to setup access to this connection per pipeline.

Create a pipeline

To create a pipeline, navigate to Pipelines and select New Pipeline.

Select Azure Repos Git as the location of your code.

Select the repository and branch that contains the extracted Dataverse solution. Azure devops should automatically select azure-pipelines.yml file from this repository. If it does not, you can select Existing Azure Pipelines YAML file and select the file from the repository.

Once the pipeline has been created, you will need to edit the pipeline to add the service connection onto the Power Platform Checker step. Click the settings link above this step to edit the setting using the GUI. Note: Don't change the position of the cursor when using the GUI as it will replace whatever the highlighted text is when you click add.

Once Completed you can press Save and run and it will execute the pipeline.

Accessing the built solution files

The built solution files will be available in the Artifacts section of the pipeline. You can download the files from here.

You should get a green tick once the pipeline has completed successfully. Once the pipeline has completed, you can download the solution files from the artifacts section of the pipeline.

Viewing the test results

The solution checker will output the results of the tests to a Sarif file. This file can be downloaded from the artifacts section of the pipeline. Alternatively, you can install the Sarif Viewer Build Tab into your DevOps organisation to view the results in the scans tab.

Release Pipelines

The release pipeline is used to deploy the solution to a Dataverse environment. The following steps are required to setup the pipeline:

  1. Create a new release pipeline using the empty job template.
  2. Add an artifact to the pipeline using the build pipeline created in the previous section.
  3. Add a stage to the pipeline if one was not created automatically.
  4. Click on the Task tab and add the following tasks to the stage
    • Power Platform Tool Installer - No configuration needed.
    • Power Platform Import Solution - Select Service Principal and choose the destination environment (setup the same as Dev service connection). For the initial deployment leave the "Import as holding solution" unticked, once the solution exists in the destination envrioment you will want to tick this to do a solution upgrade.
    • Power Platform Apply Solution Upgrade - Leave this option out for inital deployments but add it for subsequent solution upgrades. Set the service connection and provide the solution schema name.
    • Power Platform Publish Customizations - Select Service Principal and choose the destination environment. Needed for both inital and subsequent deployments.
  5. Save the pipeline & Create a release

Clone this wiki locally