Azure Pipelines architecture with DevTest Labs

Important

CI/CD with DevTest Labs is a variant of Design a CI/CD pipeline using Azure DevOps. This article focuses on the specifics of deploying to a DevTest Labs staging environments.

DevTest Labs allow you to provision Windows and Linux environments by using reusable templates and artifacts. These environments can be useful for developers, but can also be used in CI/CD pipelines for provisioning staging environments. See Azure DevTest Labs scenarios to see if DevTest labs is a good fit for your scenario.

This article describes a high-level DevOps workflow for deploying application changes using continuous integration (CI) and continuous deployment (CD) practices using Azure Pipelines. A DevTest Labs environment is used for the staging environment.

Architecture

Architecture diagram of a CI/CD pipeline using Azure Pipelines that uses Azure DevTest Labs for a staging environment.

Download a Visio file of this architecture.

Dataflow

This section assumes you have read Azure Pipelines baseline architecture and only focuses on the specifics of deploying a workload to Azure DevTest Labs for staging.

  1. PR pipeline - Same as the baseline

  2. CI pipeline - Same as the baseline

  3. CD pipeline trigger - Same as the baseline

  4. CD create DevTest Labs staging environment - This step creates the DevTest Labs environment which acts as the staging environment. The step includes:

    • Create Azure DevTest Labs environment in a staging subscription.
    • Deploy an ARM template to the DevTest Labs environment. Virtual Machine images can be stored in a shared image gallery.
    • Perform any post deployment steps to properly configure the staging environment.
  5. CD release to staging - Same as the baseline with one exception. The staging environment is a DevTest Labs environment.

  6. CD release to production - Same as the baseline

  7. Monitoring - same as the baseline

Components

This section assumes you have read Azure Pipelines baseline architecture components section and only focuses on the specifics of deploying a workload to Azure DevTest Labs for staging.

  • Azure DevTest Labs is a service for creating, using, and managing environments used for development, testing and deployment purposes. The service allows you to easily deploy pre-configured environments in a cost-effective manner.

Alternatives

  • An alternative to creating the DevTest Labs staging environment as part of the CD process, you can pre-create the environment outside of the pipeline. This will have the positive benefit of speeding up the pipeline. This alternative will stop the ability to tear down the environment after the pipeline is complete, increasing the cost.

  • In situations where VM Image Builder and a Shared Image Gallery don't work, you can set up an image factory to build VM images from the CI/CD pipeline and distribute them automatically to any Azure DevTest Labs registered to those images. For more information, see Run an image factory from Azure DevOps.

  • Additional environments, beyond staging could be created and deployed to as part of the CD pipeline. These environments could support activities like performance testing and user acceptance testing.

Considerations

This section assumes you have read the considerations section in Azure Pipelines baseline architecture and only focuses on the specifics of deploying a workload to Azure DevTest Labs for staging.

Cost Optimization

Operational Excellence

  • Consider implementing environments beyond just staging and production to enable things like rollbacks, manual acceptance testing, and performance testing. The act of using staging as the rollback environment keeps you from being able to use that environment for other purposes.

Next steps