We will learn how to approve solution deployments using Pipelines in the Power Platform. Before we start, make sure to subscribe to CRM Crate so that you can stay up to date in the field of Power Platform.
Pipelines within the Power Platform are designed to make application lifecycle management (ALM) more accessible for Power Platform and Dynamics 365 customers. They achieve this by integrating ALM automation and enabling continuous integration and continuous delivery (CI/CD) capabilities within the service, making it more user-friendly for all creators, administrators, and developers.
Pipelines notably decrease the level of effort and specialized knowledge that was previously needed to achieve a return on investment (ROI) when implementing effective, automated ALM practices within your team or organization.
Below are few key benefits of deploying your solutions through Power Platform Pipelines.
- Experienced developers have the choice to expand pipelines and execute them through the Power Platform command line interface (CLI).
- System Administrators can swiftly set up automated deployment pipelines within a matter of minutes, as opposed to the lengthier timeframe of days or weeks.
- Application makers enjoy a user-friendly experience that makes deploying their solutions a straightforward process.
- Pipelines greatly enhance the productivity of makers, developers, and administrators. They expedite the delivery of your business solutions with improved quality, all while ensuring a secure and well-regulated process.
- Pipelines save time by taking care of the complex tasks and ongoing maintenance, relieving you from those responsibilities.
How to approve / reject the deployment of solutions using Pipelines?
In a real-life scenario, we require an approver who is supposed to approve the deployment in higher environments, such as UAT and Production. The solution provided below will meet this requirement.
Step 1: Enable ‘Pre-Deployment Step Required’ setting in pipeline.
- Within your host application, open the ‘Deployment Pipeline Configuration’ app and navigate to Pipelines.
- Navigate to the ‘Deployment Stage’ sub-grid and open your existing deployment stage.
- Search for the property ‘Pre-Deployment Step Required’ and turn is ON.
This property provides additional flexibility to insert a custom step after a deployment is approved. For example, if a final approval is required before deploying the solutions via pipelines.
Pre-deployment step required1. Step starter trigger – OnPreDeploymentStarted
2. Step completed trigger – OnPreDeploymentCompleted
3. Unbound action name – UpdatePreDeploymentStepStatus
4. Approval Status – 20 = completed, 30 = rejected
Step 2: Build a Power Automate flow in Dataverse
We will need a asynchronous process to track the pipeline deployment starting point and then further create an approval process to continue the deployment. We will achieve this requirement with help of Power Automate flow as given below.
- Login to Power Automate portal (https://make.powerautomate.com/) with valid maker role.
- Create a new Automate Cloud Flow with Dataverse trigger ‘When an action is performed’ and configure it as given below.
Catalog: Microsoft Dataverse Common
Category: Power Platform Pipelines
Table Name: (none)
Action Name: OnPreDeploymentStarted
- Now we want to create a approval process to approve or reject the triggered deployment pipeline. Add an action named ‘Start and wait for an approval’ to your flow step.
Configure your approval action as per your requirements.
- Further, add a new conditional branch action to your flow where you need to check the outcome of the previously defined approval process.
- If the condition is True (Approval Process Outcome = ‘Approve’), then call an unbound action named ‘UpdatePreDeploymentStepStatus’ and configure it as given below.
PreDeploymentStepStatus: 20 (20 signifies approved)
StageRunID: Guid of pipeline stage ID which triggered the flow
- Save the flow once the configurations are completed.
Step 3: Test automated deployments using Pipelines.
Follow the below steps to test your new approval based automated deployments using Power Platform pipelines.
- Log in to a Power Platform environment through Power Apps (make.powerapps.com) or Power Automate (make.powerautomate.com) and choose your development environment.
- To utilize a pipeline for deploying a solution, navigate to the Solutions section and either create a new unmanaged solution or select an existing one for deployment.
- Within the Solutions section, select one of the two provided options to incorporate the solution into the pipeline, as described below.
a. Select Pipelines from the left navigation pane.
b. Select Overview from the left navigation pane, and then select Deploy on the command bar.
- Choose the deployment target stage, such as “Deploy to Test,” then click “Deploy here.” This action will trigger the deployment pane to appear on the right.
- Opt-in for immediate deployment by selecting ‘Deploy Now’ or set a later schedule by selecting ‘Schedule for later’, then click on “Next” in the right-hand panel. This action triggers the validation of the solution against the test environment, a process commonly known as preflight checks. During this validation, the system examines for missing dependencies and other typical issues that could potentially lead to a deployment failure.
- Review the summary of your deployment and optionally add deployment notes for future reference purpose.
- Click on”Deploy.” This action triggers an automated deployment to the designated target environment.
- Now once you click ‘Deploy’, the Power Automate flow will be triggered and a new approval process will be created for your system administrator (As per your flow’s configuration). Once the approver approves the process, the pipeline will start the deployment.
Overall, approving deployment with pipelines in the Power Platform signifies a commitment to agility, reliability, and scalability in application development. It is a pivotal step towards fostering a culture of continuous improvement and innovation within the organization, ensuring that the Power Platform is harnessed to its full potential for driving business success.