Azure Deploy
Deploy workloads to Azure with a clear, low-risk process aligned with the Well-Architected Framework.
Emphasis on idempotency, repeatable IaC, comprehensive validation, and reversible rollback paths.
Use This Skill When
- The user asks to deploy an app or service to Azure
- The user needs release automation, blue-green, or canary deployments
- The user wants Infrastructure-as-Code guidance (Bicep, Terraform)
- The user needs rollback and disaster recovery procedures
- Deployment fails and needs troubleshooting with validation steps
Context: Deployment Maturity Model
Stage 1: Manual → Portal-only, error-prone, hard to audit
Stage 2: Semi-Automated → Scripts with some IaC, inconsistent across environments
Stage 3: Fully Automated → Declarative IaC, CI/CD, infrastructure versioned ← Target
Stage 4: GitOps → All changes through pull requests, fully auditable, drift detection
Required Inputs
- Target environment: subscription ID, resource group, region, tenant
- Environment stage: dev, test, stage, prod (with distinct names)
- Workload type: web app, function, container app, AKS, VM, hybrid
- Deployment method: Azure CLI, Bicep, Terraform, ARM template, Azure Developer CLI
- Artifact readiness: built container image, versioned application package
- Security context: managed identity vs. connection string, private endpoints, secret rotation
- Validation criteria: health checks, endpoint tests, smoke tests, performance baselines
- Rollback tolerance: how many minutes can service be unavailable?
Decision Tree
Is this infrastructure or application code?
├─ Infrastructure → Use Bicep or Terraform (IaC)
└─ Application → Use Azure DevOps or GitHub Actions pipeline
Is this a net-new deployment or an update?
├─ Net-new → Deploy with full validation suite
└─ Update → Blue-green or canary strategy to minimize blast radius
Do you need instant rollback capability?
├─ Yes → Blue-green deployment (dual environments, instant traffic switch)
└─ Acceptable lag → Canary (gradual rollout with monitoring)
Workflow
Phase 1: Pre-Deployment Validation (Shift-left)
Verify prerequisites:
- Subscription access confirmed (check quota, resource limits, API provider registration)
- Role assignments correct for service principals or managed identities
- Naming conventions followed (avoid reserved names, region abbreviations)
- All secrets exist in Key Vault or secure store (never hardcode)
Review IaC and artifacts:
- Bicep/Terraform syntax validated with
bicep build or terraform plan
- No hardcoded values (use parameters and variables)
- Dependencies explicitly declared (
dependsOn, references)
- Tags and metadata complete (owner, environment, cost center)
Validate security posture:
- Network isolation: private endpoints, NSGs, firewalls
- Identity: managed identity or service principal with least privilege
- Data: encryption at rest and in transit
- Secrets stored in Key Vault with access policy
Phase 2: Artifact Preparation
Build application:
- Compile, test, and package application code
- Increment version number (semantic versioning)
- Tag artifacts with build ID or commit hash for traceability
Build container (if containerized):
- Push to Azure Container Registry (ACR) with multi-tag (
:latest, :v1.2.3, :sha-abcd1234)
- Scan image for vulnerabilities using Defender for container registries
- Verify image can be pulled from target deployment context
Archive IaC:
- Version Bicep or Terraform files in source control
- Pin module versions (never use
latest)
- Generate parameter files for each environment (dev.bicepparam, prod.bicepparam)
Phase 3: Deployment Execution
Option A: Declarative (Recommended)
az deployment group create \
--resource-group $RG \
--template-file main.bicep \
--parameters main.bicepparam \
--mode Incremental
Option B: Terraform
terraform init -backend-config=backend.tfvars
terraform plan -var-file=prod.tfvars -out=tfplan
terraform apply tfplan
- Monitor deployment progress:
- Watch Azure portal Activity Log or CLI output for errors
- Check resource creation order (dependencies respected)
- Verify DNS, network routes, and storage connectivity as resources come online
Phase 4: Post-Deployment Validation
Smoke test:
- Application endpoint responds (HTTP 200, health check passes)
- Database or data store is accessible
- Logging and monitoring are active
Integration test:
- Dependent services (API gateways, queues, caches) are reachable
- Data flows through expected paths
- Performance is within SLA targets
Security validation:
- Public exposure is blocked (no public IPs unless required)
- Managed identity credentials are working
- Key Vault access is functional
Compliance check:
- Tags and ownership metadata present
- Resource names follow naming convention
- Diagnostic logging configured
Phase 5: Rollback & Recovery
Immediate Rollback (Minutes):
- Blue-green: Switch traffic back to old deployment (instant)
- Container/App Service: Revert to previous deployment slot or image version
Longer Rollback (Hours):
- Re-deploy previous IaC snapshot from version control
- Point application to previous database snapshot
- Update DNS or traffic manager to old infrastructure
Full Disaster Recovery:
- Restore from backup or failover to secondary region
- Validate data consistency and application state
- Perform security re-validation before resuming production traffic
Output Contract
Return these sections in order:
Deployment Plan Summary
- Environment, resource group, region
- Estimated lead time for quota increases (if needed)
- High-level resource inventory and costs
Pre-Deployment Checklist
- Prerequisites validation commands or portal steps
- Required role assignments and permissions
- Security and networking decisions
Deployment Commands or IaC
- Exact CLI/Terraform/Bicep commands with parameter values
- Suggested order of operations
- Parallel vs. sequential resource creation notes
Post-Deployment Validation Checklist
- Smoke test steps (curl commands, portal checks)
- Integration test scenarios
- Performance baseline commands (ab, loadtest, etc.)
Rollback Procedure
- Step-by-step rollback sequence
- How long rollback takes
- Data consistency checks post-rollback
Risks and Assumptions
- Quota headroom assumptions
- Blast radius if deployment fails mid-stream
- Dependencies on external systems
Practical Examples
Example 1: Deploy a Container App with Traffic Split (Canary)
1. Deploy new revision to staging slot: 5% traffic
2. Monitor error rate and latency for 10 minutes
3. Shift to 25%, then 50%, then 100% in 10-minute intervals
4. If error spike detected, instant rollback to previous revision
Example 2: Blue-Green Web App Deployment
1. Deploy new version to unused deployment slot (green)
2. Run smoke and integration tests against green slot
3. Swap slots: green becomes production (instant, no downtime)
4. Keep blue slot warm for quick rollback within 1 hour
Example 3: Bicep Deployment with Parameter Overrides
az deployment group create \
--resource-group myapp-prod \
--template-file main.bicep \
--parameters main.bicepparam \
--parameters location=eastus vmCount=3 \
--mode Incremental
Guardrails
- Never hardcode secrets or connection strings in IaC, templates, or environment variables. Use Key Vault with managed identity.
- Always use
--mode Incremental for Bicep/ARM; avoid Complete mode unless you intend to delete unlisted resources.
- Avoid manual post-deployment configuration (portal UI changes). All config must be in IaC for reproducibility.
- Call out destructive operations (database migrations, resource deletions, scale-down) before execution.
- Version everything: application code, container images, IaC modules, parameter files.
- Never use
latest image tag in production; pin to specific versions.
- Test rollback procedure before going to production; don't assume it works untested.
- Separate credentials by environment; dev/test/prod each have distinct service principals and Key Vault instances.
1---2name: azure-deploy3description: Plan and execute Azure deployments safely and repeatably for applications and infrastructure. Use this skill when users ask to deploy, publish, release, or provision workloads in Azure. Covers Infrastructure-as-Code, idempotency, health validation, and rollback strategies.4---56# Azure Deploy78Deploy workloads to Azure with a clear, low-risk process aligned with the Well-Architected Framework.9Emphasis on idempotency, repeatable IaC, comprehensive validation, and reversible rollback paths.1011## Use This Skill When1213- The user asks to deploy an app or service to Azure14- The user needs release automation, blue-green, or canary deployments15- The user wants Infrastructure-as-Code guidance (Bicep, Terraform)16- The user needs rollback and disaster recovery procedures17- Deployment fails and needs troubleshooting with validation steps1819## Context: Deployment Maturity Model2021**Stage 1: Manual** → Portal-only, error-prone, hard to audit 22**Stage 2: Semi-Automated** → Scripts with some IaC, inconsistent across environments 23**Stage 3: Fully Automated** → Declarative IaC, CI/CD, infrastructure versioned ← **Target** 24**Stage 4: GitOps** → All changes through pull requests, fully auditable, drift detection2526## Required Inputs2728- **Target environment**: subscription ID, resource group, region, tenant29- **Environment stage**: dev, test, stage, prod (with distinct names)30- **Workload type**: web app, function, container app, AKS, VM, hybrid31- **Deployment method**: Azure CLI, Bicep, Terraform, ARM template, Azure Developer CLI32- **Artifact readiness**: built container image, versioned application package33- **Security context**: managed identity vs. connection string, private endpoints, secret rotation34- **Validation criteria**: health checks, endpoint tests, smoke tests, performance baselines35- **Rollback tolerance**: how many minutes can service be unavailable?3637## Decision Tree3839```40Is this infrastructure or application code?41├─ Infrastructure → Use Bicep or Terraform (IaC)42└─ Application → Use Azure DevOps or GitHub Actions pipeline4344Is this a net-new deployment or an update?45├─ Net-new → Deploy with full validation suite46└─ Update → Blue-green or canary strategy to minimize blast radius4748Do you need instant rollback capability?49├─ Yes → Blue-green deployment (dual environments, instant traffic switch)50└─ Acceptable lag → Canary (gradual rollout with monitoring)51```5253## Workflow5455### Phase 1: Pre-Deployment Validation (Shift-left)56571. **Verify prerequisites**:58 - Subscription access confirmed (check quota, resource limits, API provider registration)59 - Role assignments correct for service principals or managed identities60 - Naming conventions followed (avoid reserved names, region abbreviations)61 - All secrets exist in Key Vault or secure store (never hardcode)62632. **Review IaC and artifacts**:64 - Bicep/Terraform syntax validated with `bicep build` or `terraform plan`65 - No hardcoded values (use parameters and variables)66 - Dependencies explicitly declared (`dependsOn`, references)67 - Tags and metadata complete (owner, environment, cost center)68693. **Validate security posture**:70 - Network isolation: private endpoints, NSGs, firewalls71 - Identity: managed identity or service principal with least privilege72 - Data: encryption at rest and in transit73 - Secrets stored in Key Vault with access policy7475### Phase 2: Artifact Preparation76771. **Build application**:78 - Compile, test, and package application code79 - Increment version number (semantic versioning)80 - Tag artifacts with build ID or commit hash for traceability81822. **Build container (if containerized)**:83 - Push to Azure Container Registry (ACR) with multi-tag (`:latest`, `:v1.2.3`, `:sha-abcd1234`)84 - Scan image for vulnerabilities using Defender for container registries85 - Verify image can be pulled from target deployment context86873. **Archive IaC**:88 - Version Bicep or Terraform files in source control89 - Pin module versions (never use `latest`)90 - Generate parameter files for each environment (dev.bicepparam, prod.bicepparam)9192### Phase 3: Deployment Execution9394**Option A: Declarative (Recommended)**95```bash96az deployment group create \97 --resource-group $RG \98 --template-file main.bicep \99 --parameters main.bicepparam \100 --mode Incremental101```102103**Option B: Terraform**104```bash105terraform init -backend-config=backend.tfvars106terraform plan -var-file=prod.tfvars -out=tfplan107terraform apply tfplan108```1091104. **Monitor deployment progress**:111 - Watch Azure portal Activity Log or CLI output for errors112 - Check resource creation order (dependencies respected)113 - Verify DNS, network routes, and storage connectivity as resources come online114115### Phase 4: Post-Deployment Validation1161171. **Smoke test**:118 - Application endpoint responds (HTTP 200, health check passes)119 - Database or data store is accessible120 - Logging and monitoring are active1211222. **Integration test**:123 - Dependent services (API gateways, queues, caches) are reachable124 - Data flows through expected paths125 - Performance is within SLA targets1261273. **Security validation**:128 - Public exposure is blocked (no public IPs unless required)129 - Managed identity credentials are working130 - Key Vault access is functional1311324. **Compliance check**:133 - Tags and ownership metadata present134 - Resource names follow naming convention135 - Diagnostic logging configured136137### Phase 5: Rollback & Recovery138139**Immediate Rollback (Minutes)**:140- **Blue-green**: Switch traffic back to old deployment (instant)141- **Container/App Service**: Revert to previous deployment slot or image version142143**Longer Rollback (Hours)**:144- Re-deploy previous IaC snapshot from version control145- Point application to previous database snapshot146- Update DNS or traffic manager to old infrastructure147148**Full Disaster Recovery**:149- Restore from backup or failover to secondary region150- Validate data consistency and application state151- Perform security re-validation before resuming production traffic152153## Output Contract154155Return these sections in order:1561571. **Deployment Plan Summary**158 - Environment, resource group, region159 - Estimated lead time for quota increases (if needed)160 - High-level resource inventory and costs1611622. **Pre-Deployment Checklist**163 - Prerequisites validation commands or portal steps164 - Required role assignments and permissions165 - Security and networking decisions1661673. **Deployment Commands or IaC**168 - Exact CLI/Terraform/Bicep commands with parameter values169 - Suggested order of operations170 - Parallel vs. sequential resource creation notes1711724. **Post-Deployment Validation Checklist**173 - Smoke test steps (curl commands, portal checks)174 - Integration test scenarios175 - Performance baseline commands (ab, loadtest, etc.)1761775. **Rollback Procedure**178 - Step-by-step rollback sequence179 - How long rollback takes180 - Data consistency checks post-rollback1811826. **Risks and Assumptions**183 - Quota headroom assumptions184 - Blast radius if deployment fails mid-stream185 - Dependencies on external systems186187## Practical Examples188189### Example 1: Deploy a Container App with Traffic Split (Canary)190```1911. Deploy new revision to staging slot: 5% traffic1922. Monitor error rate and latency for 10 minutes1933. Shift to 25%, then 50%, then 100% in 10-minute intervals1944. If error spike detected, instant rollback to previous revision195```196197### Example 2: Blue-Green Web App Deployment198```1991. Deploy new version to unused deployment slot (green)2002. Run smoke and integration tests against green slot2013. Swap slots: green becomes production (instant, no downtime)2024. Keep blue slot warm for quick rollback within 1 hour203```204205### Example 3: Bicep Deployment with Parameter Overrides206```207az deployment group create \208 --resource-group myapp-prod \209 --template-file main.bicep \210 --parameters main.bicepparam \211 --parameters location=eastus vmCount=3 \212 --mode Incremental213```214215## Guardrails216217- **Never hardcode secrets or connection strings** in IaC, templates, or environment variables. Use Key Vault with managed identity.218- **Always use `--mode Incremental`** for Bicep/ARM; avoid `Complete` mode unless you intend to delete unlisted resources.219- **Avoid manual post-deployment configuration** (portal UI changes). All config must be in IaC for reproducibility.220- **Call out destructive operations** (database migrations, resource deletions, scale-down) before execution.221- **Version everything**: application code, container images, IaC modules, parameter files.222- **Never use `latest` image tag in production**; pin to specific versions.223- **Test rollback procedure before going to production**; don't assume it works untested.224- **Separate credentials by environment**; dev/test/prod each have distinct service principals and Key Vault instances.