Azure DevOps – Approvals and Checks
1. What are Approvals and Checks?
Approvals and Checks are used in Azure DevOps to control deployments, especially to important environments like UAT and Production.
-
Approval: Requires an authorized person to approve deployment.
-
Check: Verifies certain conditions before deployment, such as branch restrictions or successful validation.
Example: Before deploying an ASP.NET Core application to Production, the Project Manager or Release Manager must approve it.
2. How does it work?
Developer Pushes Code
|
v
CI Pipeline
|
v
Build Artifact
|
v
Deploy to DEV
|
v
Deploy to SIT
|
v
Deploy to UAT
|
v
Production Deployment Stage
|
v
Approval Required
|
├── Rejected → Deployment Stops
|
└── Approved
|
v
Run Remaining Checks
|
v
Deploy to Production
|
v
Deployment Successful
Azure DevOps evaluates configured checks before allowing the Production stage to execute.
3. How to configure Production approval
Follow these steps in Azure DevOps:
-
Open Azure DevOps → Pipelines → Environments.
-
Create or select the Production environment.
-
Click Approvals and checks.
-
Click + and select Approvals.
-
Add approvers (Release Manager, Team Lead, etc.).
-
Configure approval settings and click Create.
Now, whenever a pipeline tries to deploy to Production, Azure DevOps waits for approval.
4. YAML example
- stage: Production
displayName: 'Deploy to Production'
jobs:
- deployment: DeployProduction
environment: 'Production'
strategy:
runOnce:
deploy:
steps:
- task: AzureWebApp@1
inputs:
azureSubscription: 'AzureConnection'
appName: 'myapp-prod'
package: '$(Pipeline.Workspace)/drop/webapp.zip'
Important: Approval is configured in the Azure DevOps Environment, not directly in the YAML file.
When this deployment job targets Production, Azure DevOps checks whether approval is required before running the stage.
5. Common types of checks
|
Check |
Purpose |
|---|---|
|
Manual Approval |
Requires approval from authorized users |
|
Branch Control |
Allows deployment only from approved branches |
|
Business Hours |
Restricts deployment to specified hours |
|
REST API Check |
Validates external conditions |
|
Exclusive Lock |
Prevents conflicting concurrent deployments |
6. Interview answer
Question: How do you require approval before Production deployment?
Answer:
"In Azure DevOps, we configure approvals and checks on the Production environment.
We navigate to Pipelines → Environments → Production → Approvals and checks and add authorized approvers.
Our YAML pipeline contains a deployment job targeting the Production environment.
When the pipeline reaches the Production stage, Azure DevOps pauses and waits for approval.
Once approved and all configured checks pass, the application is deployed to Production."
Remember: Production Environment → Approval Required → Approved → Deployment Starts.