OnDeploymentRequest – The Breakdown

OnDeploymentRequest – The Breakdown

What’s New?

With the release of Power Platform Pipelines Extensibility, we are now drawn into a new era of deployment possibility within the Power Platform.

The release included a variety of Dataverse event triggers that allows us as developers to make use of custom logic throughout a deployment stage. These trigger events include:

  • OnDeploymentRequested
  • OnDeploymentCompleted
  • OnDeploymentStarted
  • OnPreDeploymentStarted
  • OnPreDeploymentCompleted

Today we’re going to focus on our “OnDeploymentRequested” trigger.

 

The Trigger

The OnDeploymentRequested trigger allows for developers to create custom logic and processes on top of a deployment once a deployment through Power Platform Pipelines has been requested.

 

How It Works?

When a deployment stage is enabled for pre-deployment configuration (read more about that here), a new deployment run through Power Platform Pipelines rights a requested to the Stage Runs table and triggers a Dataverse Event called, “OnDeploymentRequested”. At this point, the deployment status is listed as 10 (Pending).

 

Creating Logic

Now that a deployment event has been triggered, we can now create out custom logic. Within Power Automate, we can create a new flow that uses the Dataverse, “When an action is performed” trigger. When configuring this trigger, we need to define our options as follows:

This trigger now looks at the action name “OnDeploymentRequested” and waits for an event to be triggered through a Power Platform Pipelines deployment

 

Your next step would be to to create an action and get a Dataverse Row by ID. Using the trigger, retrieve the deployment record status so we can use it for later. By doing this now, we can also use any recorded data related to the deployment. At this point, you can apply whatever logic you deem necessary. Some use cases i have solved with are:

  • Requesting approvals from Team Leads through Approvals in Teams
  • Capturing deployments into an approval application
  • Relating Azure DevOps projects to a deployment and creating Test Plans
  • Creating Quality Assurance Assessments and assigning to a QA Team.

These are only a few ideas of what we can achieve through the OnDeploymentRequest trigger.

 

Closing The Loop

Every person/company requires their own processes and workflows, so make sure that you create the logic that best suits your requirements. However, with the OnDeploymentRequest trigger, it has to be told what to do at some point. Ultimately, you’re left with 3 options. You can either leave the deployment as Pending (but why 😭), you can reject the deployment, or you can approve the deployment.

 

Using the Dataverse action, “Perform an unbound action”, you can close the loop and decide how you want to end your deployment. When using the “UpdatePreDeploymentStepStatus”, you need to define a Status for the deployment. the status code 20 refers to approved, whereas the status code 30 refers to rejected. At this point, you can also input related comments, but need to provide the StageRunId from the original event trigger.

You can of course continue with further logic by making use of other deployment actions, but to close a simple deployment process, our journey ends here.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *