Azure DevOps Environments and Approvals

Indira Raghavan
3 min readOct 3, 2020

--

Manually control pipeline stages using Approval check

A successful build doesn’t necessarily mean deploy-ready. Most organizations have automatic and manual checkpoints to ensure all best practices are followed before code hits live(or staging) environment.

After all conditions are met we can add one final step before a build artifact is deployed to live. A manual approval process, a final sign-off if you will, to ensure all necessary business and stakeholders are in the know.

Approval step

Azure DevOps provides Environments and Approval checks for those environments to ensure the necessary approvals are met before deployment commences. The idea is to have a person/group of users approve the deployment stage.

Let’s say we have a pipeline with just build and deploy stages:

Pipeline stages

By adding an environment in the pipeline yaml file we can automatically create an environment for a stage. You can also create the environment on the DevOps board and refer to it in the YAML as well. For eg.,

Let’s go ahead and add the approval check for the development environment:

Environment → development → Approval and checks as shown below.

Approval with individual

Keep in mind, ALL the approvers added in here are required to approve for the stage to commence. If you need to have multiple people but anyone can approve, simply create a User group and provide the group name as approver.

approval using group

Approval process in action:

Let’s trigger the pipeline, now once the build is complete and stage reaches development environment stage, it will wait for reviewer approval. The approver will also receive an email requesting the same.

Email requesting approval

In conclusion

You can manually control execution of a stage in multi-stage pipeline using approval checks. You can use approval checks to control deployments to production environments.

--

--

Indira Raghavan
Indira Raghavan

No responses yet