1. How do you restrict who can deploy to Production?
In Azure DevOps, we restrict Production deployment using Permissions, Approvals, and Checks.
How does it work?
-
Create a Production Environment in Azure DevOps.
-
Configure Approvals and Checks.
-
Add authorized approvers, such as the Release Manager or Tech Lead.
-
Restrict which users and pipelines can access the Production environment.
-
Deployment proceeds only after the required approval.
Example:
Build Completed
↓
Deploy to DEV
↓
Deploy to SIT
↓
Deploy to UAT
↓
Production Deployment Requested
↓
Approval Required
↓
Release Manager Approves
↓
Deploy to Production
Interview Answer:
We restrict Production deployments using Azure DevOps Environment permissions, pipeline permissions, and approval checks. Only authorized users can approve deployments, and only permitted pipelines can deploy to Production.
2. How do you handle a failed deployment and roll back to a previous successful version?
Rollback means restoring the previous working version of an application when a new deployment fails.
How does it work?
-
Deploy the new version to Production.
-
If deployment fails, stop the release or further rollout.
-
Identify the last successful build artifact.
-
Redeploy that previous artifact to Production.
-
Verify the application is working using health checks and testing.
Example:
Production: Version 1.0 (Working)
↓
Deploy Version 2.0
↓
Deployment Failed
↓
Select Previous Successful Artifact
↓
Redeploy Version 1.0
↓
Verify Application
↓
Production Restored
How to do it in Azure DevOps?
-
Open Azure DevOps → Pipelines.
-
Find the previous successful pipeline run.
-
Select its deployment stage and redeploy the previous artifact, using the pipeline's supported rerun or redeployment process.
-
Verify the Production application.
Important: In Azure App Service, we can also use Deployment Slots to swap back to the previous version, provided the previous version remains available in the other slot.
Interview Answer:
If a Production deployment fails, I identify the last successful build artifact and redeploy it using Azure Pipelines. After rollback, I verify application health and functionality. For Azure App Service, deployment slots can also support quick rollback.
Key Point: Always use the same previously tested build artifact for rollback instead of rebuilding the old source code. Database changes may require a separate rollback or recovery plan.