
Power Platform Pipelines pre-deployment approval flow
Table of contents:
Some time ago I have recorded a video about using the pre-deployment actions in Power Platform Pipelines. These actions would allow you to create e.g. approval workflow. In this post I am describing actions, that the mentioned workflow is using.
The video I mentioned you can find here:
Pre-deployment configuration
To be able to use the pre-deployment actions, you need to open the “Deployment Pipeline Configuration” app in you Power Platform Pipelines host environment, then navigate to “Pipelines” and select a stage within a pipeline, where you want to activate the feature. Then select a checkbox “Pre-Deployment Step Required”:

Power Automate configuration
Trigger
The trigger that you use is: “When an action is performed”, and it should be configured as following:
Speaking about the “Action name”, there are several types, triggered based on various conditions, that you can choose from:
- OnDeploymentCompleted – when the whole deployment is completed.
- OnDeploymentRequested – when the actual deployment is requested.
- OnDeploymentStarted – when the actual deployment is started.
- OnPreDeploymentCompleted – when the pre-deployment stage is completed.
- OnPreDeploymentStarted – when the pre-deployment is started – the request has been placed and the mentioned above checkbox is selected.
Approval
For the approval itself there is not really much to say. What is important, is that depending on the approval outcome – approved/ rejected, the deployment request must be updated with a different status:

- The action name would be “UpdatePreDeploymentStepStatus”.
- StageRunId is a value taken from the triggerBody() outputs (returned by the trigger action).
- PreDeploymentStepStatus when approved is 20 – this would complete this step successfully and then trigger the “OnDeploymentRequested” action. When rejected value should be set to 30 – which means the step ended up with an error.
Get exported solution files
There are two solution files generated each time a deployment is started. Unmanaged and managed. You can get these files in your process and store them in the file repository or code repository of your choice. For this purpose I am using the “HTTP with Azure AD” action. Then to get base64 encoded string for:
- Managed solution file: use the dynamic outcome from trigger:
@{triggerOutputs()?['body/OutputParameters/ArtifactFileDownloadLink']}
- Unmanaged solution file: replace ArtifactDownloadLink in the value above with ArtifactFileUnmanagedDownloadLink:
@{replace(triggerOutputs()?['body/OutputParameters/ArtifactFileDownloadLink'], 'artifactfile', 'artifactfileunmanaged')}
In the end use the: @{body('HTTP_with_Azure_AD')?['body']?['$content']}
to retrieve the pure base64 string that you can use to create file in e.g. SharePoint or Github:

And that’s it! I hope this will be really helpful for you 🙂