For the complete documentation index, see llms.txt. This page is also available as Markdown.

Canary Deployment

Configure and execute Canary Azure Container Apps deployments with progressive traffic shifting.

This guide explains how to configure and execute progressive Canary deployments for Azure Container Apps using gradual traffic shifting in Harness.

FEATURE FLAG

This feature is behind the feature flag CDS_AZURE_CONTAINER_APPS. Contact Harness Support to enable this feature.

Prerequisites for Canary deployment

Before setting up your Canary deployment, ensure you have the following Azure resources already configured:

  • Harness Account: Active account with the Continuous Delivery module enabled

  • Azure Subscription: An active Azure subscription with appropriate permissions

  • Azure Connector: A Harness connector to Azure using OIDC or Service Principal authentication

  • Managed Environment: An Azure Container Apps managed environment where your container apps will be deployed

  • Container Registry: Azure Container Registry (ACR), Docker Hub, or another supported container registry with your container images

  • IAM Permissions: Service principal with permissions to manage Container Apps, Managed Environments, and related resources

Select deployment strategy

After configuring your service, environment, and infrastructure, navigate to the Execution tab and select the Canary execution strategy. Harness automatically adds a pre-configured step group containing all the necessary deployment steps. This automated setup eliminates manual configuration and ensures best practices for zero-downtime deployments with progressive traffic shifting.

Click to view full size image

The step group includes four steps: Download Manifests, Prepare Rollback Data, Deploy, and Traffic Shift. You can add additional Traffic Shift steps for progressive rollout.

Step configuration

The Canary deployment workflow uses three default steps plus manually added Traffic Shift steps. All steps must be added within a Container Step Group.

CONTAINERIZED STEP GROUP REQUIRED

All Azure Container Apps deployment steps must be added within a Container Step Group (also called a Containerized Step Group). These steps run as containerized tasks and require the container infrastructure configuration (Kubernetes connector and namespace) provided by the step group. The steps will not execute without being placed in a Container Step Group.

1. Download Manifests

Click to view full size image
Parameter
Description
Required
Default

Name

Display name for the step

No

DownloadManifests

Timeout

Maximum time allowed for downloading manifests

No

10m

This step downloads all manifest files specified in your service configuration and makes them available for subsequent deployment steps.

For detailed information on how this step works, see Download Manifests.

2. Azure Container Apps Prepare Rollback Data

Click to view full size image
Parameter
Description
Required
Default

Name

Display name for the step

No

-

Timeout

Maximum time for the step to complete

No

10m

Container Registry

Harness connector for the deployment plugin image

Yes

-

Image

Deployment plugin container image

Yes

harness/azure-container-apps-plugin:0.0.1-linux-amd64

Image Pull Policy

Policy for pulling the container image

No

Always

This step captures the current state of your container app before deployment begins, enabling rollback if needed.

For detailed information on how this step works, see Azure Container Apps Prepare Rollback Data.

3. Azure Container Apps Deploy

Click to view full size image
Parameter
Description
Required
Default

Name

Display name for the step

No

-

Timeout

Maximum time for the step to complete

No

30m

Skip Traffic Shift

Creates revision without traffic cutover

No

false

Container Registry

Harness connector for the deployment plugin image

Yes

-

Image

Deployment plugin container image

Yes

harness/azure-container-apps-plugin:0.0.1-linux-amd64

Image Pull Policy

Policy for pulling the container image

No

Always

This step creates a new revision with your updated container image. For Canary deployments, enable Skip Traffic Shift to create the revision without shifting traffic.

For Canary deployment, Skip Traffic Shift must be enabled (checked) to prevent immediate traffic cutover. Traffic shifting is then controlled by separate Traffic Shift steps. The screenshot above shows this correctly configured.

For detailed information on how this step works, see Azure Container Apps Deploy.

4. Azure Container Apps Traffic Shift (Manually Added)

Click to view full size image
Parameter
Description
Required
Default

Name

Display name for the step

No

-

Timeout

Maximum time for the step to complete

No

30m

Revision Name

Revision to receive traffic (latest, secondlatest, or exact name)

Yes

-

Traffic Value

Percentage of traffic (0-100, sum must equal 100)

Yes

-

Tag

Optional tag for testing specific revisions

No

-

Container Registry

Harness connector for the deployment plugin image

Yes

-

Image

Deployment plugin container image

Yes

harness/azure-container-apps-plugin:0.0.1-linux-amd64

Image Pull Policy

Policy for pulling the container image

No

Always

This step controls progressive traffic distribution. Add multiple instances for gradual rollout (e.g., 20% → 70% → 100%).

For detailed information on how this step works, see Azure Container Apps Traffic Shift.

5. Azure Container Apps Rollback (In Rollback Tab)

The rollback step is automatically added to the Rollback tab when you select the Canary deployment strategy. Click the Rollback tab to view the rollback configuration.

Click to view full size image
Click to view full size image
Parameter
Description
Required
Default

Name

Display name for the step

No

Azure Container Apps Rollback

Timeout

Maximum time for the step to complete

No

30m

Container Registry

Harness connector for the deployment plugin image

Yes

-

Image

Deployment plugin container image

Yes

harness/azure-container-apps-plugin:0.0.1-linux-amd64

Image Pull Policy

Policy for pulling the container image

No

Always

This step restores your container app to its previous state using the rollback data captured before deployment. It executes automatically when a deployment fails or when you manually trigger a rollback.

For detailed information on how this step works, see Azure Container Apps Rollback.

How Canary deployment works

Canary deployment enables gradual rollout of new versions by progressively shifting traffic from existing revisions to the new revision. This approach minimizes risk by allowing you to validate new deployments with a small percentage of traffic before exposing them to your entire user base.

Unlike Basic deployment which shifts traffic immediately, Canary deployment gives you control over traffic distribution at each stage, allowing you to monitor metrics and halt or rollback if issues arise.

Deployment flow

Phase 1: Download Manifests

The Download Manifests step fetches all manifest files specified in your service configuration and makes them available for subsequent deployment steps. Harness downloads the Azure Container Apps manifest from your configured manifest store (Inline, Harness File Store, or Git), validates the YAML/JSON structure, and stages it for use by the deployment steps.

What this step does:

  • Fetches all manifest files configured in your service definition

  • Downloads Azure Container Apps manifest from your configured manifest store

  • Validates the YAML/JSON structure of the manifest

  • Stages the manifest files in a temporary directory (/harness/m1/)

  • Makes manifests available for subsequent deployment steps

Example output:

Phase 2: Prepare Rollback Data

The Azure Container Apps Prepare Rollback Data step captures the current state of your container app before deployment begins. This step reads the Azure Container Apps manifest to identify the container app name, retrieves the current state from Azure including active revisions and traffic weights, and stores this information for use by the rollback step if deployment fails or issues are detected.

What this step captures:

  • Current active revisions and their traffic weights

  • Current traffic configuration

  • Revision names and status

  • Container app configuration settings

  • Managed environment details

  • Resource group and subscription information

This data ensures that if something goes wrong during deployment, Harness can restore your container app to its exact previous state, including traffic distribution across revisions.

Example log output:

Phase 3: Deploy New Revision

The Azure Container Apps Deploy step creates a new revision with your updated container image. Harness reads the manifest configuration, injects the container image URL from your artifact configuration, and creates the new revision in Azure Container Apps.

Deployment behavior for Canary:

For progressive Canary deployments, you must enable Skip Traffic Shift (set to true) in the Deploy step:

  • Skip Traffic Shift = enabled (true): The Deploy step only creates the new revision without shifting traffic to it. Traffic shifting is performed explicitly in subsequent Azure Container Apps Traffic Shift steps. This is required for progressive Canary deployments where you want full control over gradual traffic shifting.

  • Skip Traffic Shift = disabled (false): This is the default for Basic deployment where traffic shifts immediately to the new revision. Do not use this setting for progressive Canary deployments.

The Deploy step completes the following operations in four phases:

Phase 1: Parsing manifest

Harness reads the Azure Container Apps manifest to extract the container app name and validate the configuration.

Phase 2: Preparing deployment

Harness prepares the deployment by determining the Azure region, injecting the container image URL (replaces placeholder in the manifest), and setting the active revisions mode to Multiple to support traffic splitting across revisions.

Phase 3: Deploying container app

Harness deploys the container app to Azure, creating a new revision with the updated configuration. The new revision is created but receives no traffic initially.

Phase 4: Finalizing outputs

Harness waits for the deployment to stabilize and outputs the current state. Notice the new revision (aca-aut-test--0000001) receives 0% traffic, while the old revision still receives 100%. The Deploy step outputs the new revision name, which you can reference in traffic shift steps using the latest alias or expressions.

Phase 4: Traffic Shifting

For progressive Canary deployments, you manually add Azure Container Apps Traffic Shift steps after the Deploy step to enable gradual traffic shifting from old revisions to the new revision. This gives you full control over when and how traffic moves to the new revision.

To enable progressive traffic shifting:

  1. Enable Skip Traffic Shift in the Deploy step

  2. Add one or more Azure Container Apps Traffic Shift steps after the Deploy step

The Traffic Shift step performs the following operations in four phases:

Phase 1: Parsing inputs

Harness reads the traffic configuration and resolves revision aliases to actual revision names. You can use latest (most recently created revision) or secondlatest (second most recent revision) instead of hardcoding revision names.

Phase 2: Activating required revisions

Harness ensures that all revisions specified in the traffic configuration are active. If multiple revisions need to receive traffic, the step sets the active revisions mode to Multiple (required for traffic splitting in Azure Container Apps).

Phase 3: Applying traffic shift

Harness updates the traffic configuration in Azure Container Apps to match your specified distribution. Traffic is split according to the weights you configured, and optional tags can be assigned to revisions for testing specific versions.

Phase 4: Finalizing outputs

Harness waits for the traffic shift to stabilize (typically 1 minute) and outputs the current state, including revision status, replica counts, traffic distribution, and instance details.

Example traffic shift progression:

  • Traffic Shift 1: 20% to latest (new revision), 80% to secondlatest (old revision)

  • Traffic Shift 2: 70% to latest, 30% to secondlatest

  • Traffic Shift 3: 100% to latest

Between each shift, you can monitor application metrics, error rates, and performance before proceeding to the next step. You can also add manual approval steps or custom verification steps between traffic shifts.

Gradual traffic shifting

For safe production rollouts, you can add multiple Azure Container Apps Traffic Shift steps with increasing traffic percentages. This enables you to validate the new revision at each traffic level before increasing exposure.

Example phased rollout:

  1. Traffic Shift 1: 20% to latest (new), 80% to secondlatest (old) - initial validation with minimal risk

  2. Traffic Shift 2: 70% to latest, 30% to secondlatest - balanced load testing

  3. Traffic Shift 3: 100% to latest, 0% to secondlatest - full cutover

Between each shift, you can:

  • Monitor application metrics and error rates

  • Run verification steps or manual approvals

  • Add custom scripts or API calls for validation

  • Roll back if issues are detected

Rollback

When deployment fails or issues are detected, Harness can automatically roll back to the previous state using the rollback data captured during the Prepare Rollback Data step.

Rollback process:

  1. Retrieves the rollback data captured before deployment

  2. Restores the traffic configuration to the previous state

  3. Restores the previous revision traffic weights

  4. Reactivates previous revisions as needed

The rollback step is automatically added to your pipeline's rollback section when you select the Canary strategy.

Complete pipeline examples

Canary deployment pipeline

This example shows a complete Canary deployment pipeline with gradual traffic shifting. The pipeline deploys a new revision and progressively shifts traffic in three stages: 20% → 70% → 100%.

Complete Pipeline YAML Example

Last updated

Was this helpful?