|
| 1 | +--- |
| 2 | +title: Tutorial - Configure canary deployments for Azure Linux Virtual Machines |
| 3 | +description: In this tutorial you will learn how to set up continuous deployment (CD) pipeline that updates a group of Azure Linux Virtual Machines using canary deployment strategy |
| 4 | +author: moala |
| 5 | +manager: jpconnock |
| 6 | +tags: azure-devops-pipelines |
| 7 | + |
| 8 | +ms.assetid: |
| 9 | +ms.service: virtual-machines-linux |
| 10 | +ms.topic: tutorial |
| 11 | +ms.tgt_pltfrm: azure-pipelines |
| 12 | +ms.workload: infrastructure |
| 13 | +ms.date: 4/10/2020 |
| 14 | +ms.author: moala |
| 15 | +ms.custom: devops |
| 16 | + |
| 17 | +#Customer intent: As a developer, I want to learn about CI/CD features in Azure so that I can use devops services like Azure Pipelines to build and deploy my applications automatically. |
| 18 | +--- |
| 19 | + |
| 20 | +# Tutorial - Configure Canary deployment strategy for Azure Linux Virtual Machines |
| 21 | + |
| 22 | + |
| 23 | +## IaaS - Configure CI/CD |
| 24 | +Azure Pipelines provides a complete, fully featured set of CI/CD automation tools for deployments to virtual machines. You can configure a continuous delivery pipeline for an Azure VM directly from Azure portal. This document contains the steps associated with setting up a CI/CD pipeline that uses the Canary strategy for multi-machine deployments. You can also take a look at other strategies like [rolling](https://aka.ms/AA7jlh8) and [blue-green](https://aka.ms/AA83fwu), which are supported out-of-box from Azure portal. |
| 25 | + |
| 26 | + |
| 27 | +**Configure CI/CD on Virtual Machines** |
| 28 | + |
| 29 | +Virtual machines can be added as targets to a [deployment group](https://docs.microsoft.com/azure/devops/pipelines/release/deployment-groups) and can be targeted for multi-machine updates. Once deployed, the **Deployment History** within your deployment group provides traceability from VM to the pipeline and then to the commit. |
| 30 | + |
| 31 | + |
| 32 | +**Canary Deployments**: A canary deployment reduces risk by slowly rolling out the change to a small subset of users. As you gain more confidence in the new version, you can start releasing it to more servers in your infrastructure and routing more users to it. |
| 33 | +You can configure canary deployments to your virtual machines with the Azure portal using continuous delivery option. |
| 34 | +Here is the step-by-step walkthrough. |
| 35 | +1. Sign in to your Azure portal and navigate to a virtual machine |
| 36 | +2. In the VM left pane, navigate to the **Continuous delivery** menu. Click **Configure**. |
| 37 | + |
| 38 | +  |
| 39 | +3. In the configuration panel, click **Azure DevOps Organization** to select an existing account or create one. Then select the project under which you would like to configure the pipeline. |
| 40 | + |
| 41 | + |
| 42 | +  |
| 43 | +4. A deployment group is a logical set of deployment target machines that represent the physical environments; for example, "Dev", "Test", "UAT", and "Production". You can create a new deployment group or select an existing deployment group. |
| 44 | +5. Select the build pipeline that publishes the package to be deployed to the virtual machine. Note that the published package should have a deployment script _deploy.ps1_ or _deploy.sh_ in the `deployscripts` folder at the package root. This deployment script will be executed by the Azure DevOps pipeline at run time. |
| 45 | +6. Select the deployment strategy of your choice. Select **Canary**. |
| 46 | +7. Add a 'canary' tag to the VMs that are to be part of canary deployments and a 'prod' tag to the VMs that are part of deployments after canary deployment in successful. Tags help you target VMs that have specific role only. |
| 47 | + |
| 48 | + |
| 49 | +8. Click **OK** on the dialog to configure the continuous delivery pipeline. You will now have a continuous delivery pipeline configured to deploy to the virtual machine. |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | +9. Click on **Edit** release pipeline in Azure DevOps to see the pipeline configuration. The pipeline consists of three phases. The first phase is a deployment group phase and deploys to VMs that are tagged as _canary_. The second phase, pauses the pipeline and waits for manual intervention to resume the run. Once a user is satisfied that canary deployment is stable, they can resume the pipeline run which will then run the third phase that deploys to VMs tagged as _prod_. |
| 54 | + |
| 55 | + |
| 56 | +10. Before resuming the pipeline run, make sure that at least one VM is tagged as _prod_. In the third phase of the pipeline, the application will be deployed to only those VMs that have _prod_ tag. |
| 57 | + |
| 58 | +11. The Execute Deploy Script task will by default execute the deployment script _deploy.ps1_ or _deploy.sh_ in 'deployscripts' folder at the root directory of published package. Make sure that the selected build pipeline publishes this in the root folder of package. |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | +## Other deployment strategies |
| 65 | +- [Configure Rolling Deployment Strategy](https://aka.ms/AA7jlh8) |
| 66 | +- [Configure Blue-Green Deployment Strategy](https://aka.ms/AA83fwu) |
| 67 | + |
| 68 | +## Azure DevOps project |
| 69 | +Get started with Azure more easily than ever. |
| 70 | + |
| 71 | +With DevOps Projects, start running your application on any Azure service in just three steps: select an application language, a runtime, and an Azure service. |
| 72 | + |
| 73 | +[Learn more](https://azure.microsoft.com/features/devops-projects/ ). |
| 74 | + |
| 75 | +## Additional resources |
| 76 | +- [Deploy to Azure Virtual Machines using DevOps project](https://docs.microsoft.com/azure/devops-project/azure-devops-project-vms) |
| 77 | +- [Implement continuous deployment of your app to an Azure Virtual Machine Scale Set](https://docs.microsoft.com/azure/devops/pipelines/apps/cd/azure/deploy-azure-scaleset) |
0 commit comments