Azure DevOps is the one-stop solution that encompasses task and test management, source control, and pipelines for the build, unit test, and deploy solutions. Using Azure DevOps provides Power Platform projects with a framework through which implementation activities may be managed and monitored. In this chapter, you will learn how to implement task management, source control, and application life cycle management (ALM) using Azure DevOps.
In this chapter, we are going to cover the following topics:
Power Platform solution architects are often responsible for creating a base structure that holds requirements, tasks, and bugs. Azure DevOps includes four work item models:
You will typically work with product owners and business analysts to select the most appropriate model for the project. The project’s work items are created and distributed across the team for implementation. The following screenshot illustrates a set of work items for a Power Platform Portal and Model-Driven App backend solution:
Azure DevOps’s work item processes allow the business to track and manage the work being carried out by the implementation teams and provide a compass and clear directives for each team member to work on.
Azure DevOps provides two types of source control: Git and Team Foundation Version Control (previously known as TFS). A source control repository is created by default when a new Azure DevOps project is instantiated, where the user is presented with the aforementioned version control options:
Additional repositories may be added, which may differ from the default. The following screenshot shows an additional repository being created within an existing project:
Source control is an essential part of the Power Platform implementation process, typically storing the following artifacts:
Solution architects define the project’s ways of working to ensure all team members develop and manage sources within the Azure DevOps repositories.
Power Platform solutions contain the definition for tables, processes, apps, forms, and other components used to define the Power Platform configuration. These solutions are exported from a source/development environment as ZIP files and then imported into target environments (for example, QA and production environments).
Storing Power Platform solutions in a source control environment provides a means of recording and versioning the system’s configuration. Deployments to target environments may also be carried out from solution files stored in source control. Automated deployments will be discussed in more detail in the upcoming sections.
Solution files may be stored either as ZIP files or extracted to a file and folder structure using the Power Platform SolutionPackager tool (please refer to the SolutionPackager tool’s docs for additional details: https://docs.microsoft.com/power-platform/alm/solution-packager-tool).
The following screenshot illustrates a typical source control folder structure that’s used to store Power Platform solutions:
Solution files may be checked into source control manually or via an automated process such as an Azure DevOps pipeline. Manually submitting solution files may be carried out using standard source control tools (for example, the Azure DevOps web portal itself). The next section discusses the options available for automated source control of Power Platform solutions.
Azure DevOps pipelines provide a mechanism for automated source control of Power Platform solutions. Solutions may be exported, validated, extracted, and checked into a source control repository. The following diagram illustrates a typical Azure DevOps pipeline that automatically checks solutions into a repository:
The Azure DevOps pipeline shown in the preceding diagram can be created by following these steps:
Navigate to the Pipelines option within the Azure DevOps project:
In the New pipeline screen, select the Use the classic editor option. Selecting this option will allow you to create DevOps tasks using an editor UI:
Selecting the source control repository and branch where Power Platform solutions will be checked into Azure DevOps provides both Git and TFVC options for version control.
In this example, we will be using the Azure Repos Git option:
After that, select the Empty job option to start from a clear pipeline:
Search for and add the Power Platform Export Solution task using the same method when adding the Power Platform Tool Installer task and set the following key fields:
The following screenshot illustrates a task that’s been configured to export a managed solution:
Now, let’s look at creating a new service principal.
You will be presented with a form similar to the following:
If an Azure Application Registration and corresponding Power Platform Application User have already been created, you can proceed to fill in the New service connection form. Alternatively, the steps required to create these are as follows.
Note
Application registrations may be created via the Azure portal/Power Platform admin center or a PowerShell script. For details on creating service principals using PowerShell, please refer to https://docs.microsoft.com/power-platform/alm/devops-build-tools#configure-service-connections-using-a-service-principal.
Add a new app registration:
Next, we will generate a secret for the app registration via the Certificates & secrets menu, selecting the validity period as required. After the secret expires, a new secret will need to be generated and the Azure DevOps service principal updated. The following screenshot shows an app registration secret being generated with an expiry period of 12 months:
The app registration secret is used instead of a password when authenticating using a service principal. It is important to note the automatically generated secret at the point it is created, as it is not possible to retrieve it from the Azure portal at a later date. The app registration secret is displayed as follows:
Now that we have the application ID, tenant ID, and application secret, we can complete the Azure DevOps Power Platform service connection form:
Once the app registration is in place, you can create a matching Power Platform Application User. From the Power Platform admin center, navigate to the environment that requires the service principal connection and open the Application users screen:
From the Application users screen, select New app user. Select a security role with sufficient administrative privileges to export solutions (in the following screenshot, we have selected a custom security role called DevOps that will provide enough privileges):
Pressing the + Add an app button will bring up all the app registrations that exist in the tenant. Select the app registration you created for this particular Application User:
Once the app registration and security roles have been set, click the Create button:
Once the application user has been created, they can be managed via the Power Platform Application users view:
We have now configured the following:
With these three components in place, the Azure DevOps pipelines are ready to communicate with the Power Platform environment.
With the Azure DevOps service principal in place, we can set the corresponding field on the Power Platform Export Solution task:
Now is a great time to validate the connection from Azure DevOps to the Power Platform environment. Pressing the Save and Queue button (or just Queue if the save option is not available) will run the pipeline tasks in sequence:
If this is the first pipeline you’ve created within an Azure DevOps organization, you may find that the parallelism capacity for Microsoft-hosted pipeline agents is 0. If that is the case, the pipeline execution will exit with the following error:
There are three options to resolve this pipeline capacity issue:
Once capacity has been increased, pipelines will run without displaying a capacity error.
We have created a task to export a Power Platform solution and validated it as functional and able to connect to Dataverse. At this point, you may wish to extract any other solutions that make up the implementation. A managed version of the solution may also be exported for safe-keeping in source control.
Adding Power Platform Export Solution tasks will be the same as the first export – that is, changing the source solution to be exported and deciding whether to export a managed/unmanaged solution. The following screenshot shows four Power Platform Export Solution tasks, where a core solution and a flows solution are being exported in both managed and unmanaged formats:
An Azure DevOps pipeline is ideal for running an automated Power Platform solution checker. Once the solution files have been exported, running a solution check can help ensure only solutions that meet the project’s specific quality criteria are checked into source control and deployed to target environments.
Add a task by searching for Power Platform Checker and configuring the following key fields:
The following screenshot illustrates the Power Platform solution checker options:
Extracting a Power Platform solution into its individual components results in a folder and file structure that is better suited for source control and versioning than a ZIP file.
In this example, we will clear the folder where the extracted solution components live (as a previous check-in would have filled the folder already) before extracting our freshly exported Power Platform solutions. The sequence of tasks is illustrated in the following screenshot:
First, we must add an action to Delete files that were previously extracted and checked into source control. The following example clears the PowerPlatform.Solutions/Extracted/Core folder, ready for the new set of components to be extracted:
You must repeat the Delete files action for as many folders as required to ensure all previously extracted solution components have been cleared. This prevents deleted Power Platform components from resurfacing unexpectedly.
We are now ready to add a Power Platform Unpack Solution task to the pipeline. The key configuration parameters to be completed are as follows:
The following link provides additional details on the solution packer options related to this task: https://docs.microsoft.com/power-platform/alm/solution-packager-tool.
You must then repeat the Power Platform Unpack Solution task for any other solutions that have been extracted in the previous pipeline steps.
Once the solutions have been exported, verified, and unpacked, they are ready to be checked into source control. There are various ways of checking in files from a DevOps pipeline. In our example, we will be using Git as our source control repository and a Command line task to carry out the necessary Git commands.
The following screenshot illustrates a Command line task that checks all updates into a Git repository, including solution ZIP files and extracted solution components:
The command-line script that’s been used in the example pipeline task is as follows:
echo -- Starting checking of solutions to source control
git config user.email "[email protected]"
git config user.name "DevOps Pipeline"
echo -- Checking out branch
git checkout devops
echo -- Committing branch
git add --all
git commit -m "DevOps Power Platform Solution check in"
echo -- Pushing branch
git -c http.extraheader="AUTHORIZATION: bearer $(System.AccessToken)" push origin devops
echo -- Checking complete
Note that the command-line script references a System.AccessToken, a variable that’s automatically populated by the pipeline to facilitate authentication. The following pipeline agent setting must be ticked for System.AccessToken to be accessible to the script:
Finally, the project user needs Contribute permissions to be able to check the solution files into the repository. Permission may be assigned to the project user via the Repository menu on the project’s settings page, as shown in the following screenshot:
Once the pipeline tasks have been completed, the entire process can be validated through a sequence of test runs. The runtime logs provide a means of troubleshooting any issues that are encountered by the steps until the pipeline configuration runs through to completion, as shown in the following screenshot:
Unless configured otherwise, DevOps pipelines are triggered manually. Depending on the project team’s ways of working, performing a daily check-in of the Power Platform solution may be beneficial. Scheduled check-ins also have the added benefit of alerting the DevOps team of any issues with the solutions. The process will fail if the solution checker finds problems with the exported solutions.
The following screenshot shows the pipeline configured for execution every night at 23:00 hours:
With that, we have created an Azure DevOps pipeline that extracts solutions from a development environment, runs the Power Platform solution checker, extracts the solution components, and checks the results into source control. In the next section, we will look at source control for Power Pages.
Power Pages store their configurations in Dataverse tables. As a result, configuration for Power Pages can be exported and deployed using standard tools such as the Configuration Data Migration tool or XRMToolbox plugins such as Portal Records Mover.
The Portal Records Mover plugin provides a mechanism for exporting Power Page configurations to files and for direct transfer from one environment to another. It has handy features that enable/disable system plugins that would otherwise conflict with the import process. The following screenshot illustrates the main screen of Portal Records Mover:
The Portal Records Mover configuration files may be exported and stored in source control alongside its setting files, as follows:
Reference Documentation on the Portal Records Mover Plugin
For further details on the Portal Records Mover plugin for XrmToolbox, please go to https://www.xrmtoolbox.com/plugins/MscrmTools.PortalRecordsMover/.
Storing Power Page JavaScript and CSS configurations in source control will also provide a means of versioning and tracking changes. These files can be managed manually or exported into a folder structure similar to the one shown in the following screenshot by using the Portal Code Editor plugin for XrmToolbox:
The Portal Code Editor export facility is shown in the following screenshot:
Reference Documentation on the Portal Code Editor Plugin
For further details on the Portal Code Editor plugin for XrmToolbox, please go to https://www.xrmtoolbox.com/plugins/MscrmTools.PortalCodeEditor/.
The Power Pages extension for Visual Studio Code also downloads and edits portal code, including Liquid templates. For further details, please go to https://docs.microsoft.com/en-us/power-apps/maker/portals/vs-code-extension.
Dataverse plugins are built using the .NET Framework and follow standard C# source control practices. All Dataverse plugins should be checked into source control, where they will be used for future enhancements and bug fixes:
In this section, we reviewed the options available for storing and managing Power Platform configurations in source control. The next chapter discusses automated Power Platform deployments. But for now, let’s learn how to leverage Azure DevOps for ALM.
Releases in Azure DevOps effectively manage the application life cycle for Power Platform solutions. The concept of Releases revolves around a set of source artifacts (for example, Power Platform solution files) and a sequence of release pipelines that deploy those artifacts to target environments (for example, QA and PROD Power Platform environments).
Solution architects configure release pipelines, setting up a framework for continuous delivery that provides the following benefits:
In this section, we will create a Release Pipeline that deploys to QA and production environments from source control.
In this section, we will create a release pipeline that retrieves Power Platform solution files stored in source control, validates the solution files by testing the deployment to a validation environment, and then proceeds to deploy the solution to QA if valid. The deployment to the production environment can then be triggered manually, using precisely the same solution files deployed to QA.
The following diagram illustrates the Release Pipeline we are about to create:
Follow these steps to create an Azure DevOps Release Pipeline:
Navigate to the Azure DevOps Pipelines | Releases menu and select the New release pipeline option:
When asked to select a template, select the Empty job option to create a Power Platform deployment release:
A stage is automatically added when the release is created. In our scenario, we will label the stage VALIDATION as it will check the solution and run a test deployment to a VALIDATION environment:
Select the Add an artifact option and select the repository and branch that holds the Power Platform solution files (please see the previous section for details on creating a build pipeline that automatically checks Power Platform solutions into source control):
The newly created VALIDATION stage is currently empty. Clicking on the job/task option highlighted in the following screenshot will bring up the stage editor:
The first task to add will be the Power Platform Tool Installer task (please see the previous section for details on installing Power Platform Tools on a new Azure DevOps organization):
Add the Power Platform Checker task to the stage:
Proceed to configure the Power Platform Checker task to validate the solutions that are about to be imported into the target system. In this scenario, we will be checking all the managed solutions in the Packed folder, as shown in the following screenshot:
The service connections we set up in the previous section may be used for this exercise.
The Power Platform Backup Environment task will create a backup of the VALIDATION environment before the solutions are imported, which can later be used to restore the environment to the state before the solutions were imported:
Note
When using a service principal connection, the Power Platform Backup Environment task requires additional privileges to perform the backup. The following document provides details on how to set up the service principal using PowerShell: https://docs.microsoft.com/en-us/power-platform/admin/powerplatform-api-create-service-principal.
Search for the Power Platform Import Solution task and configure it to import the first Power Platform solution to a target environment. The process is the same as the solution import tasks we completed in the previous section:
Any other solutions that need to be imported into a target system must be added as additional tasks in the Release stage. We added a second Flows solution import task in the following screenshot:
Save the stage and select Create release to test the Release pipeline:
Any issues that are raised during the execution of the release may be resolved in the same way as standard pipelines.
Now that the VALIDATION stage has been completed and tested, we can create a QA deployment stage:
Select the Clone option below the VALIDATION stage to replicate the stage:
Name the stage appropriately (for example, QA) and update all the Power Platform-related tasks, ensuring they point to the correct target environment:
Clone the QA stage, naming the new stage appropriately (for example, PROD), and update all the Power Platform-related tasks, ensuring they point to the production Power Platform environment:
On the newly created PROD stage, select the trigger option:
Configure the trigger for the PROD stage to be manual, providing additional control over the deployment:
The Power Platform-related tasks in the PROD stage should now also be updated, with each one pointing to the corresponding production Power Platform environment.
Now that we have a process in place, we are ready to test the release cycle end-to-end. Selecting the Create release option will kick off the deployments:
The Release starts with all stages pending execution:
As the release progresses, the VALIDATION stage will run through to completion. If successful, it will automatically trigger the QA deployment stage:
Once the QA deployment is complete, the release will update the status of the stages accordingly. The PROD stage has been configured to be triggered manually. Once the QA deployment has been validated, the release into production may be initiated by selecting the release instance, as shown in the following diagram:
On the Release instance page, the PROD deployment may be initiated by selecting the Deploy option below the corresponding stage:
Once the deployment to production is complete, the stages will be marked accordingly:
The Azure DevOps Release we configured in this section is an example of how a Power Platform application life cycle can be implemented. As a solution architect, you will assess the level of automation and controls required by the project.
Azure DevOps pipelines may also be configured to deploy configuration data onto target environments. The Power DevOps Tools provide just such facilities, extending Azure DevOps capabilities. Reference data and Power Pages configuration may be automatically deployed to target environments using the Import Config Migration Data task. Please reference the following Azure DevOps Marketplace page for details: https://marketplace.visualstudio.com/items?itemName=WaelHamze.xrm-ci-framework-build-tasks.
In this section, we worked through the Azure DevOps pipeline and release management process.
In this chapter, you learned how to leverage Azure DevOps’s task management, source control, and release management capabilities. You are now ready to set up the ALM source control and release processes for Power Platform implementations.
In the next chapter, you will learn how to define go-live strategies, resolve performance bottlenecks, troubleshoot data migrations, and ensure the go-live readiness of your Power Platform projects.
18.224.59.231