A delegated deployment in Power Platform Pipelines is performed by the service account rather than the user who pressed the deploy button. This is useful because we can grant the service account elevated permissions to the target environment while the user is prevented from making any direct changes inside of the environment. It forces them to use pipelines for deployment, which is a good thing. And if the service account performs the initial deployment of a solution the apps and flows within it will be owned by the service account in the new environment.
Table Of Contents:
• Create A Power Automate Flow To Approve Delegated Deployments
• Auto-Approve A Delegated Deployment In Power Platform Pipelines
• Enable Delegated Deployment For A Pipeline Deployment Stage
• Deploy The Solution As The Service Account
• Review The Delegated Deployment Results
Create A Power Automate Flow To Approve Delegated Deployments
Power Platform Pipelines delegated deployments require an approval. Currently, the only way to perform this approval is by using a Power Automate flow.
Go to the Pipelines Host environment and create a new solution named Pipelines Extensions.

Then create a new Power Automate flow with an automated trigger inside of the Pipelines Extensions solution.

Name the solution Approve Pipelines Deployment and select the when an action is performed Dataverse trigger.

Auto-Approve A Delegated Deployment In Power Platform Pipelines
Delegated deployments require an approval but we want the approval to be automatic. Set the flow trigger category to Power Platform Pipelines and use the action name OnApprovalStarted. Then add a condition where true=true so it will always evaluate to yes. Inside of the yes condition, perform an unbound action with the following parameters:
- Action Name – UpdateApprovalStatus
- Approval Properties – workflow()
- StageRunId – Action Inputs StageRunId
- Approval Status – 20 (approved)
Also, in the no condition perform the same unbound action with an Approval Status of 30 (rejected). Although it is not necessary in this scenario we have setup the no condition to understand how do it.

Enable Delegated Deployment For A Pipeline Deployment Stage
A delegated deployment can be setup from the deployment stage record in the deployment pipeline configuration app. Launch the app and go to the Pipelines page. Select the ALM Tutorial Pipeline and locate the deployment stages subgrid.

Open the test deployment stage and check Is Delegated Deployment. Choose the Delegated Deployment Type Stage Owner and set the Owner to the Service Account. Save and close the record.

Do the same for the production deployment stage.

Deploy The Solution As The Service Account
The test and production deployment stages are now setup to perform delegated deployments. All future Power Platform Pipeline runs will be performed by the service account.
Go to the Pipelines menu for the sample solution and press the deploy here button to deploy the solution to the test environment.

Work through the deploying solution wizard and then press the deploy button on the final page.

Review The Delegated Deployment Results
Wait for the Power Platform Pipeline to complete the solution deployment.

Once completed, the deployment stage will show the new version number and last deployed date. Then go to the test environment to review the solution and ensure it deployed correctly.

Look at the latest run in the Approve Pipelines Deployment flow run history. It shows the auto-approval to the test deployment stage.

Next Steps
The next section “Configure Pre-Deployment Stage Approvals” will be posted on March 17. Or, you can get the entire Power Platform Pipelines & ALM Setup Guide right now by subscribing to my newsletter.
Did You Enjoy This Article? 😺
Subscribe to get new Power Apps & Power Automate articles sent to your inbox each week for FREE
Questions?
If you have any questions about Perform A Delegated Deployment Using A Service Account please leave a message in the comments section below. You can post using your email address and are not required to create an account to join the discussion.