Search code examples
azure-devopsazure-web-app-serviceazure-pipelinesazure-app-service-planscanary-deployment

Azure App Service Canary Deployment through Pipeline


We use Azure Devops process to do a deploy to our staging slot and then we do a straight swap between staging and production.

We note that through the portal interface we can direct a percent of the traffic to staging, is there a method to do this through Azure Devops/CD process so that we direct a percent of traffic to a specific slot and then gradually increase, essentially a canary deployment method via the pipeline using Azure Web App Slots?

Thank you in advance.


Solution

  • Looking at the documentation it looks that is possible:

    Deployments slots

    Next to the Azure portal, you can also use the az webapp traffic-routing set command in the Azure CLI to set the routing percentages from CI/CD tools like DevOps pipelines or other automation systems.

    you can use this command to increase traffic:

    az webapp traffic-routing set --distribution staging=50 --name MyWebApp --resource-group MyResourceGroup
    

    and with Start-Sleep -Seconds 10 you can gradually increase percentage.