In the world of continuous integration and continuous delivery (CI/CD), Azure DevOps agents are key resources. These agents are the compute resources that execute your pipeline whether it’s compiling code, running tests, or deploying applications. Without them, your DevOps pipelines are just scripts waiting to be run.
Azure DevOps offers two types of agents: Microsoft-hosted and self-hosted. Microsoft-hosted agents are ephemeral, pre-configured virtual machines spun up by Azure for each job. They’re convenient and easy to use, but they come with limitations such as longer queue times during peak hours, no customization, no persistent state between jobs and they are on the public network.
Self-hosted agents, on the other hand, give you full control. You manage the environment, install custom tools, and can optimize performance with persistent caching, plus you can put them on a private network for connectivity to your private resources. However with great power comes great responsibility as self-hosting means managing infrastructure, scaling, security and deployment.
In this post, we’ll explore five popular methods for hosting self-hosted Azure DevOps agents on Azure: Virtual Machines (VMs), Virtual Machine Scale Sets (VMSS), Azure Kubernetes Service (AKS), Azure Container Instances (ACI), and Azure Managed DevOps Pools. We’ll compare them across cost, setup complexity, scalability, and management overhead, and help you decide which is best for your scenario.
Virtual Machines (VMs): The Classic Approach
Hosting agents on Azure VMs is the most straightforward method. You provision a VM, install the agent, and configure it to connect to your DevOps organization. This method gives you full control over the environment, making it ideal for pipelines that require custom tooling or access to private networks.
However, VMs require manual scaling and patching. If your workloads spike, you’ll need to provision additional VMs manually or automate the process with scripts. Monitoring and lifecycle management also fall on your shoulders.
Cost-wise, VMs are predictable but not always efficient. You pay for uptime, regardless of whether the agent is actively running jobs. Reserved Instances or Spot VMs can help reduce costs, but they add complexity.
Best for: Stable workloads, custom environments, and teams with infrastructure expertise.
Virtual Machine Scale Sets (VMSS): Scalable and Efficient
VMSS builds on the VM model by allowing you to deploy and manage a set of identical VMs. With autoscaling capabilities, VMSS can respond to demand dynamically—spinning up agents during peak hours and scaling down during idle periods.
This method is more efficient than standalone VMs, especially when combined with Spot VMs. You can also use custom images to pre-install tools and dependencies, reducing setup time per agent.
While VMSS reduces management overhead compared to VMs, it still requires image management, monitoring, and patching. Automation tools like Packer, Terraform, or Bicep can streamline this process.
Best for: Workloads with variable demand, cost-conscious teams, and those looking for scalable infrastructure.
Azure Kubernetes Service (AKS): Container-Native Power
AKS is a powerful option for teams already invested in Kubernetes. Agents run as pods within a cluster, offering high scalability and efficient resource utilization. You can deploy agents on-demand, integrate with containerized workloads, and orchestrate complex deployments.
The trade-off is complexity. AKS requires Kubernetes expertise, and managing the cluster/nodes, networking, storage, and upgrades all add overhead. But for teams comfortable with containers, AKS offers unmatched flexibility.
Cost efficiency is high, especially with autoscaling and Spot node pools. You pay for the underlying VMs, but can optimize usage with fine-grained control.
Best for: Container-native teams, high-scale environments, and advanced orchestration needs.
Azure Container Instances (ACI): Lightweight and Ephemeral
ACI is the simplest way to run containers in Azure. You don’t manage VMs or clusters—just define your container and run it. For DevOps agents, this means you can spin up an agent for a single job and tear it down immediately after.
This method is ideal for burst workloads or proof-of-concept pipelines. There’s no persistent storage or caching, so it’s not suitable for long-running or stateful jobs. Customization is limited, but the simplicity is hard to beat.
Cost is billed per second, based on CPU and memory usage. For short-lived jobs, ACI can be extremely cost-effective.
Best for: Ephemeral workloads, quick jobs, and teams prioritizing simplicity.
Azure Managed DevOps Pools: The Future of Self-Hosting
Azure Managed DevOps Pools aim to make self-hosted agents a managed service. These agents run in a managed pool, with Microsoft handling infrastructure side, while still allowing for imaging, connectivity and settings to be controlled by you.
This model reduces infrastructure management while retaining the benefits of self-hosting. You don’t manage VMs or clusters, and setup is minimal. However, control over the underlying infrastructure and design is reduced. These are also among the easiest to manage via IaC, since they can be provisioned as a single declarative resource.
Pricing is a combination of parallel jobs pricing, Azure Storage, Azure Managed Disks and Virtual Machines, but expected to be competitive with VMSS. As an example, if your selected Azure VM size costs £0.09 per hour, and you are projected to run 4000 hours of jobs, your projected monthly cost for hourly services would be about £351.20.
Best for: Enterprises seeking balance between control and convenience, and teams wanting persistent agents without infrastructure burden.
Visual Comparison
Below is a radar‑style grid so you can see at a glance how each approach ranks across Security, Cost, Scalability, Ops Overhead, and Customisation.
(5 = strongest / best, 1 = weakest / least)
| Method | Security | Cost Efficiency | Scalability | Ops Overhead | Customisation |
|---|---|---|---|---|---|
| AKS | ⭐⭐⭐⭐⭐ (Full network control, private endpoints) | ⭐⭐⭐ (mid‑range) | ⭐⭐⭐⭐⭐ (node pools + autoscaling) | ⭐⭐ (cluster mgmt required) | ⭐⭐⭐⭐⭐ (container‑level control) |
| ACI | ⭐⭐⭐⭐ (isolated containers) | ⭐⭐⭐⭐ (cheap for burst workloads) | ⭐⭐ (limited autoscaling) | ⭐⭐⭐⭐ (very low mgmt) | ⭐⭐⭐ (moderate flexibility) |
| VM | ⭐⭐⭐⭐ (private network, stable) | ⭐⭐ (always‑on compute) | ⭐ (no autoscale) | ⭐⭐ (patching + maintenance) | ⭐⭐⭐⭐ (full OS control) |
| VMSS | ⭐⭐⭐⭐⭐ (private networking + image mgmt) | ⭐⭐⭐⭐ (scale‑to‑zero possible) | ⭐⭐⭐⭐⭐ (native autoscale) | ⭐⭐⭐ (image pipeline + infra mgmt) | ⭐⭐⭐⭐ (custom images, ephemeral agents) |
| Managed DevOps Pools | ⭐⭐⭐⭐⭐ (Microsoft-maintained + Azure integration) | ⭐⭐⭐ (mid‑to‑upper cost range) | ⭐⭐⭐⭐⭐ (built‑in scaling + standby agents) | ⭐⭐⭐⭐⭐ (lowest overhead) | ⭐⭐ (limited to supported agent images) |
Conclusion: Matching Strategy to Scenario
There’s no one-size-fits-all answer when it comes to hosting Azure DevOps agents. The right choice depends on your team’s needs, infrastructure maturity, and workload characteristics.
- If you need full control and have predictable workloads, VMs are a reliable choice.
- For scalable, cost-efficient deployments, VMSS offers a great balance.
- If you’re already using Kubernetes, AKS provides powerful orchestration.
- For lightweight, ephemeral jobs, ACI is hard to beat.
- And for enterprise teams looking to minimize management while retaining performance, Azure Managed DevOps Pools maybe the go-to option.
As Azure continues to evolve, staying informed and adaptable is key. Whether you’re optimizing cost, simplifying management, or scaling pipelines, choosing the right agent hosting strategy can make a significant impact on your DevOps velocity.