Hybrid pipelines allow you to create a single workflow that uses both Azure-hosted resources and your own on-premises computers or servers. This is done by writing YAML pipeline definitions that can run tasks in both places. This flexibility lets you keep sensitive testing or development tasks on your local network while still using Azure's powerful cloud services for other parts of your build and deployment process. The goal is to maintain a consistent CI/CD operation across these different environments without having to use separate tools.
You can use Azure DevTest Labs to create and manage virtual machines (VMs) that act as build or release agents for your pipelines. These VMs are created from preconfigured ARM templates or formulas, which automatically install all the necessary software and tools. This approach gives each development team a private, controlled environment that matches production, allowing for safe testing and parallel builds. The lifecycle of these VMs is managed by the lab, so you can start them when needed for a build and shut them down to save costs.
A self-hosted agent is a software program you install on your own VM, whether it's located in Azure or in your on-premises data center. You register these agents to an agent pool in Azure Pipelines, which organizes and controls them. To keep these agents secure, you connect them to Azure using a service connection that is backed by a service principal or a managed identity. This setup allows the agent to authenticate itself and follow your organization's security rules (RBAC) when it needs to access Azure resources like storage or databases.
To create a hybrid pipeline, you write YAML code that includes specific tasks. These tasks often use command-line tools like the Azure CLI or PowerShell scripts. For example, a pipeline task might create a new VM to act as a self-hosted agent, configure it, and then add it to an agent pool. Another task might use an Azure Resource Manager service connection to deploy an application's infrastructure from an ARM template. By combining these elements, you build a pipeline that can automatically scale its agent capacity and securely handle operations across cloud and on-premises boundaries.
Seeking the thrill of transformative tech? Explore the art of designing and implementing DevOps solutions on Azure. Master the shift towards CI/CD, testing, and delivery, while preparing for the Designing and Implementing Microsoft DevOps Solutions exam!
Prepare and test your skills

Prepare and test your skills

A hybrid pipeline is a single YAML-based workflow that uses both Azure-hosted resources and on-premises computers or servers, allowing you to maintain consistent CI/CD operations across different environments without using separate tools.
Azure DevTest Labs creates and manages virtual machines from preconfigured ARM templates or formulas that automatically install all necessary software and tools, giving each development team a private, controlled environment for safe testing and parallel builds.
Self-hosted agents are secured by connecting them to Azure through a service connection backed by a service principal or managed identity, which allows the agent to authenticate and follow organizational RBAC rules when accessing Azure resources.
YAML hybrid pipelines commonly use Azure CLI or PowerShell script tasks to create and configure VMs as self-hosted agents, add them to agent pools, and deploy infrastructure using Azure Resource Manager service connections.