An Azure service that provides a general-purpose, serverless container platform.
Faisal Riaz, Please find responses to your questions below:
- Changes required in Aspire.AppHost Program.cs
In most cases, no major changes are required in Aspire.AppHost Program.cs.
Blue/Green deployment with Azure Container Apps is primarily handled through:
- ACA revisions
- Revision labels
- Traffic switching
- CI/CD orchestration
Your Aspire AppHost can generally remain unchanged.
Optionally, you may add deployment slot/environment metadata, logging tags, telemetry attributes
Example:
- DEPLOYMENT_SLOT = blue/green
- revision identifier for diagnostics
However, separate Aspire manifests or separate AppHost projects are typically NOT required for ACA revision-based Blue/Green deployments.
- Blue/Green deployment suffix
Yes, using revision suffixes is recommended.
However, the suffix should normally be added during deployment/pipeline execution, not directly inside the application code.
Recommended approach:
- Add revision suffix in Azure CLI deployment commands within the pipeline.
Example: az containerapp update --revision-suffix green-$(Build.BuildId)
This allows ACA to create separate revisions such as:
- portal-api--blue-123
- portal-api--green-124
This is the preferred enterprise approach because:
- deployment logic stays outside application code
- easier rollback
- easier automation
- Changes required in infra/bicep
Yes, some infra changes are required. Most important change is enabling multiple active revisions in Azure Container Apps.
Example: activeRevisionsMode: 'multiple'
Without this configuration, ACA replaces the old revision automatically, which prevents Blue/Green deployment behavior.
Regarding automatic updates:
- Aspire manifest/AppHost changes do NOT automatically handle all ACA revision settings.
- It is recommended to explicitly define revision configuration inside your Bicep/IaC templates.
Usually only minimal Bicep changes are required:
- activeRevisionsMode
- optional ingress traffic configuration
No major redesign of networking resources should be necessary.
- Changes required in existing azd pipeline YAML Yes, the pipeline requires the most significant changes for Blue/Green deployment.
Recommended flow within the SAME pipeline:
- Build image
- Deploy Green revision
- Assign 0% traffic initially
- Run validation/smoke tests
- Switch traffic to Green
- Keep Blue revision available for rollback
- Rollback automatically if validation fails
Recommended deployment pattern:
Build → Deploy Green Revision → Validate Green → Manual Approval (optional) → Switch Traffic → Monitor → Retain Blue for rollback window
Traffic switching can be performed using: az containerapp ingress traffic set
Example: az containerapp ingress traffic set --label-weight blue=0 green=100
Rollback: az containerapp ingress traffic set --label-weight blue=100 green=0
A single pipeline is generally recommended instead of maintaining separate Blue/Green pipelines because:
- easier orchestration
- simpler approvals
- centralized rollback logic
- better traceability
- Sequential deployment with templates Sequential deployment is completely fine and actually aligns well with Blue/Green strategies.
Recommended approach:
- Deploy all services sequentially to Green revisions first
- Validate the full environment
- Switch traffic only after the entire deployment succeeds
This avoids version mismatch scenarios between APIs/frontend/background services.
- Effect on cache and background services This is an important consideration.
Cache: If shared cache (Redis etc.) is used, Blue and Green revisions will typically share the same cache.
Recommended best practices:
- Keep cache contracts backward compatible
- Avoid breaking serialization changes
- Prefer versioned cache keys if schema changes occur
Example: customer:v2:123 instead of: customer:123
Background services / workers: This area requires extra attention.
Potential issue:
- Both Blue and Green worker revisions may process the same queue simultaneously
- This can lead to duplicate processing or race conditions
Recommended approach:
- APIs/UI → use Blue/Green revisions
- Background workers → keep only one active revision
For workers/consumers/schedulers:
- scale old revision to 0 before enabling new revision OR
- deploy workers separately from API traffic switching
This is usually the safest enterprise pattern for queue-based workloads.
Overall recommendation:
For your current architecture, the recommended production approach is:
- Single ACA Environment
- Multiple ACA revisions
- Revision labels (blue/green)
- Traffic switching through ACA ingress
- Same App Gateway/WAF
- Same Private DNS
- Same Key Vault and private endpoints
- Pipeline-driven validation and rollback