Designing Automated Deployment
This lesson explains infrastructure as code, pipelines and release strategies.
Learning outcomes
After completing this lesson, you will be able to:
- Compare Bicep, Terraform and deployment stacks.
- Explain how pipelines authenticate without secrets.
- Compare rolling, blue-green and canary releases.
Infrastructure as code
Infrastructure as code (IaC) describes resources in files that are versioned, reviewed and deployed automatically. Each environment is then built from the same definition, which eliminates drift caused by manual change. A declarative tool describes the desired end state, and the deployment engine works out how to reach it.
Azure Resource Manager templates and Bicep
ARM templates are JSON documents, and Bicep is a more concise language that compiles to the same deployment format. Bicep is the recommended native option, as it has no state file and supports new Azure resources immediately. Modules support reuse.
Terraform
Terraform is a third-party tool that keeps a state file and supports many providers. It suits organizations that already use it, or that deploy across several clouds.
Template specs and deployment stacks
Template specs store templates in Azure with versioning and RBAC, so that teams can share approved templates. Deployment stacks treat a group of resources as a managed unit. A stack can delete resources that no longer appear in the template, and deny settings can stop anyone changing or deleting them outside the stack, with the options denyDelete and denyWriteAndDelete.
The following comparison summarizes the choice of tool.
Choosing IaC
Deployment pipelines
A pipeline automates the path from a code change to production. Continuous integration (CI) builds and tests each change. Continuous delivery (CD) deploys that change through environments, usually with approval gates before production. GitHub Actions and Azure Pipelines are the two main options: both can build, test and deploy to Azure, and an organization normally chooses according to where its source code lives.
Pipelines should authenticate to Azure with workload identity federation, which means no long-lived secrets are stored in the pipeline. Template validation, security scanning and a preview of changes through a what-if operation all reduce risk before deployment. Production deployment should be restricted to the pipeline, so that a change cannot bypass review.
The following diagram follows a release from GitHub to a new container app revision with no stored credentials.

Release strategies
A deployment strategy limits the impact of a faulty release, and each option balances cost, speed and risk.
- Rolling replaces instances in batches. It needs no extra capacity, but old and new versions run together during the update.
- Blue-green runs two identical environments, and traffic switches from one to the other. Rollback is instantaneous, and App Service deployment slots provide this model.
- Canary sends a small percentage of traffic to the new version, then increases it if health is good. It limits exposure, and Azure Container Apps revisions and Front Door weights support it.
- Feature flags separate deployment from release, enabling a feature for selected users.
Databases need particular care. A schema change should be backward compatible with the previous application version, so that a rollback remains possible. Rolling out in stages, also known as safe deployment practices, applies a change to one region first, and to others only after it has proven healthy.
Release strategies
Automating operations
Automation also extends beyond deployment. Azure Automation runs runbooks for operational tasks, and Azure Machine Configuration audits or applies settings inside machines through Azure Policy. Azure Deployment Environments retires on 22 February 2027, so developer self-service should use approved template specs or Bicep modules run through a pipeline. Older methods, such as manual portal deployment, should be used only for experiments.
Designing a release process
A company deploys a containerized API on Azure Container Apps and its infrastructure with Bicep from GitHub. Security forbids storing Azure credentials in GitHub. New versions must receive 10% of traffic at first, and platform resources such as the virtual network must not be changed or deleted outside the pipeline. What should you recommend?
GitHub Actions with workload identity federation authenticates to Azure with no stored secret. Container Apps revisions provide canary traffic splitting, with 10% going to the new revision until it is proven.
A deployment stack with deny settings protects the virtual network and other shared resources from change outside the stack. Azure RBAC could limit who has write access, but it would not protect against people who hold high privileges at that scope. Azure Blueprints is being retired, and manual portal deployments would not meet the control requirement.
Which strategy sends 5% of traffic to a new version and increases it gradually?
Show answer
Canary. Blue-green switches all traffic at once, and rolling replaces instances in batches.
Exam Tips
Remember for the exam
- Bicep for Azure-only IaC; Terraform for multi-cloud; deployment stacks for lifecycle and deny settings.
- Use workload identity federation for pipelines.
- Blue-green switches environments; canary shifts a percentage of traffic; rolling replaces batches.
- Keep database schema changes backward compatible.