So friends, whoās using Power Platform Pipelines to support their simple CICD deployments when building with low-code on Power Platform? Let me know how youāre using these in the comments of this post, Iād love to know!
In this post, Iād like to share with you some cool capabilities that let us extend Power Platform Pipelines! Weāll specifically focus on how to embed approval processes into Power Platform Pipelines to prevent deployments prior to the appropriate person approving us making that action.
Pre-Deployment Steps
So, when it comes to extending pipelines with something like an approvals workflow, the way we do this is by requiring a pre-deployment step within the deployment stage configuration of our pipeline.
So here I have a deployment pipeline in my tenant which Iāve configured a few stages for.

Now letās jump into my deploy to production stage which you can see has āpre-deployment step requiredā set to yes.

Now when we have this ticked and the pipeline is run for this step a Dataverse action will be performed which we can use to then trigger a flow. We can then add processes to that flow and finish it with another action which will allow the pipeline to continue running, so the deployment can execute.
Pre-deployment flow
Okay, so now letās take a look at the flow weād need to implement to put an approvals process in place here. We will build this flow in the host environment where our pipelines configuration solution is installed. Make sure you do this otherwise you wonāt have the Dataverse actions needed for the flow.
Now for the trigger of my flow I will use āWhen an action is performedā from the Microsoft Dataverse connector.

Now populate the parameters of your trigger with the same as mine. Weāll select the followingā¦
Catalog ā Microsoft Dataverse Common
Category ā Power Platform Pipelines
Table Name ā (none)
Action Name ā OnPreDeploymentStarted

Now Iāll add some approvals logic to my flow and add a condition which will determine the next steps to take based on the outcome of the approval. If the approval was approved, Iām going to add an action from the Microsoft Dataverse connector which is āPerform an unbound actionā. Letās now configure that.
Select the UpdatePreDeploymentStepStatus action and then set the Item/PreDeploymentStepStatus parameter to 20. This will allow the pipeline to deploy and continue running the stage.

Now letās work on what happens if the approval is rejected in the false branch of the condition. Weāre going to apply the same logic except weāll populate the Item/PreDeploymentStepStatus parameter with 30 which will cancel the pipeline and prevent the stage deployment from running.

On both the approve and reject logic paths, make sure you set the StageRunId using the dynamic content from the trigger for this. Now save the flow and weāll test out a deployment!
Testing it out
Okay so now letās test this thing out! Iām going to head over to my environment where Iāve got my deployment pipeline configured and Iāll deploy a solution to my production environment.
So, when it comes to actually kicking off my deployment, you can see that Iāve got a notification that my deployment may be pending until a background process succeeds which is managed by my admin. Letās kick off the deployment.

Okay so Iāve kicked it off by selecting next and then deploy. Now check out the warning that my request is pending.

In the background my admin just got an approvals notification which they can approve or decline.

I could even improve my flow to add my comments provided in the approval to the comments parameter in my action to allow my pipeline to proceed or to cancel it so the developer gets some response. For now Iāll just approve the deployment.
And just like that my deployment is now running!

And just to take a look at what happened in the background, you can see my pre-deployment step flow ran successfully and my PreDeploymentStepStatus was updated to 20 allowing the deployment to continue.
Did you like this content? š
Did you like this content? Check out some of the other posts on my blog, and if you like those too, be sure to subscribe to get my posts directly in your inbox for free!
Subscribe