Study guide

6.3 Hosted vs. Self-Hosted Agents & Runners

Microsoft Certified: Azure DevOps Engineer Expert AZ-400

Track your progress as you read

Finished sections get a check mark.

1 Chapter 1: Flow of Work, Traceability & Work Tracking

1.1 Flow of Work, GitHub Flow & Feedback Cycles 1.2 Work Tracking with Azure Boards & GitHub Projects 1.3 End-to-End DevOps Traceability & Quality Tracking

2 Chapter 2: DevOps Metrics, Dashboards & Team Collaboration

2.1 DORA Metrics, Flow Metrics & Dashboard Design 2.2 Lifecycle Metrics Across the Six DevOps Phases 2.3 Work Item Queries, WIQL Charts & Analytics 2.4 Project Documentation: Wikis, Mermaid Diagrams & Release Notes 2.5 Webhooks, Service Hooks & Microsoft Teams ChatOps

3 Chapter 3: Git Branching Strategies & Pull Request Workflows

3.1 Git Branching Models & Strategy Design 3.2 Pull Request Workflows & Merge Strategies 3.3 Branch Policies, Quality Gates & Compliance Restrictions

4 Chapter 4: Repository Management, Optimization & Git Data Operations

4.1 Git LFS Architecture & .gitattributes Tracking 4.2 LFS History Migration, git-fat & File Locking 4.3 Git Repository Scaling, Scalar & Monorepo Governance 4.4 Repository Permissions & Git Tag Governance 4.5 Git Data Recovery & Sensitive-Data Scrubbing

5 Chapter 5: Package Management & Dependency Versioning

5.1 Selecting Package Tools: Azure Artifacts vs. GitHub Packages 5.2 Feed Scoping, Upstream Sources & Pipeline Authentication 5.3 Package Views, Immutability & Quality Promotion 5.4 Dependency Versioning: SemVer, CalVer & Automated Versioning 5.5 Pipeline Artifact Versioning & Artifact Storage Strategy

6 Chapter 6: Pipeline Infrastructure, Agents & Integration

6.1 Selecting a CI/CD Solution: Azure Pipelines vs. GitHub Actions 6.2 GitHub-Azure Pipelines Integration & Hybrid Migration 6.3 Hosted vs. Self-Hosted Agents & Runners 6.4 VMSS Elastic Pools, Container Jobs & Agent Governance 6.5 Pipeline Triggers, Filters & Concurrency Management

7 Chapter 7: YAML Pipeline Architecture & Reusable Elements

7.1 YAML Pipeline Anatomy: Stages, Jobs, Steps & Workspaces 7.2 Job Execution Order: DAG Dependencies, Parallelism & Conditions 7.3 Reusable Elements: Templates, Parameters & Variables 7.4 Variable Groups, Secret Variables & Key Vault Linking 7.5 YAML Environments, Checks & Deployment Approvals

8 Chapter 8: Testing Strategy, Quality Gates & Code Coverage

8.1 Test Strategy Design: Local, Unit & Integration Testing 8.2 Load, Stress & Performance Testing in Pipelines 8.3 Test Execution Tasks, Agents & Results Integration 8.4 Code Coverage Analysis & SonarQube Integration 8.5 Quality Gates, Release Gates & Governance Checks

9 Chapter 9: Modern Deployment Strategies & Zero-Downtime Delivery

9.1 Progressive Delivery: Blue-Green, Canary & Ring Deployments 9.2 Minimizing Downtime: Deployment Slots & Rolling Updates 9.3 Feature Flags with Azure App Configuration & Feature Manager 9.4 Designing the High-Priority Hotfix Path 9.5 Ordered Dependency Deployments, Resiliency & Rollback

10 Chapter 10: Artifact Deployment & Database DevOps

10.1 Containerized Application Delivery: ACR, AKS & Container Apps 10.2 Binary, Web App, Function & Scripted Deployments 10.3 Database DevOps: State-Based & Migration-Based Strategies

11 Chapter 11: Infrastructure as Code (IaC) & Azure Deployment Environments

11.1 Infrastructure as Code Strategy: Bicep, ARM & Terraform 11.2 Desired State Configuration & Azure Machine Configuration 11.3 Azure Deployment Environments (ADE) & Developer Self-Service

12 Chapter 12: Pipeline Maintenance, Health & Modernization

12.1 Pipeline Health, Flaky Tests & Reliability Engineering 12.2 Pipeline Optimization: Caching, Slicing & Concurrency 12.3 Artifact & Build Retention Governance 12.4 Modernizing CI/CD: Classic to YAML Migration

13 Chapter 13: Authentication, Authorization & Identity Governance

13.1 Microsoft Entra Service Principals & Managed Identities 13.2 Service Connections, Workload Identity & Personal Access Tokens 13.3 Azure DevOps Projects, Teams & Permission Evaluation 13.4 Access Levels, GitHub Roles & Outside Collaborators

14 Chapter 14: Secrets Management, Sensitive Data & DevSecOps Scanning

14.1 Azure Key Vault, Secret Variables & Secretless CI/CD 14.2 Security Scanning Strategy, GHAS & Secret Scanning 14.3 CodeQL SAST in Pipelines and Containers 14.4 Software Supply Chain, Container Scanning & Cloud Defender

15 Chapter 15: Telemetry Collection, Azure Monitor & Alerting

15.1 Azure Monitor Architecture, AMA & Data Collection Rules 15.2 Application Insights & Specialized Azure Monitor Insights 15.3 Alerting Rules, Action Groups & GitHub Repository Insights

16 Chapter 16: Telemetry Analysis, Distributed Tracing & SRE Practices

16.1 Distributed Tracing, Application Map & Exception Triage 16.2 KQL Log Analytics, SRE Observability & Error Budgets

6.3 Hosted vs. Self-Hosted Agents & Runners

Key Takeaways Explain This Topic AI

Microsoft-hosted agents provide a 2 vCPU, 7 GB RAM virtual machine that is destroyed after every job, guaranteeing a clean workspace.

Job timeout on Microsoft-hosted agents is 60 minutes for private projects on the free tier, 360 minutes with paid parallelism, and 360 minutes for public projects.

Agents communicate outbound only over HTTPS long-polling, so no inbound firewall rule can make a Microsoft-hosted agent reach a private database or licence server.

Self-hosted agents accumulate state between jobs, which is a performance advantage for caches and a correctness hazard known as the dirty workspace problem.

The private-project free tier is one Microsoft-hosted parallel job capped at 1,800 minutes per month; public projects receive ten uncapped parallel jobs.

Last updated: September 2026

6.3 Hosted vs. Self-Hosted Agents & Runners

In both Azure Pipelines and GitHub Actions, pipelines do not execute directly in the cloud management plane. Instead, orchestration engines dispatch compiled task instructions to dedicated compute engines known as Agents in Azure DevOps and Runners in GitHub Actions. Selecting, provisioning, securing, and scaling the appropriate agent infrastructure is one of the most heavily tested competency areas on the AZ-400 certification exam.

DevOps architects must balance maintenance overhead, security boundaries, build performance, cost efficiency, and network topology when selecting between Microsoft-hosted agents, static self-hosted machines, and elastic Azure Virtual Machine Scale Set (VMSS) agent pools.

1. Microsoft-Hosted Agents & GitHub-Hosted Runners

Microsoft-hosted agents and GitHub-hosted runners are fully managed, turnkey compute instances provisioned directly by Microsoft Azure.

Architectural Characteristics

Ephemeral Lifecycle : Every time a pipeline job runs, the orchestration engine provisions a fresh virtual machine from a pre-built golden operating system image. As soon as the job finishes (whether it succeeds, fails, or is canceled), the entire virtual machine is destroyed . No artifacts, temporary files, downloaded packages, or environment changes persist to subsequent jobs.

Clean-State Security : Because the VM is permanently discarded after execution, there is zero possibility of cross-build contamination, lingering malware, or accidental credential leakage between different pipeline executions or teams.

Pre-installed Toolsets : Hosted images come pre-installed with hundreds of development tools, including .NET SDKs, Java JDKs, Python runtimes, Node.js, Ruby, Go, Docker, Azure CLI, PowerShell Core, Terraform, and package managers.

Available Operating System Images :

  • ubuntu-latest (Ubuntu 22.04 / 24.04 LTS)
  • windows-latest (Windows Server 2022 / 2025 with Visual Studio Enterprise)
  • macos-latest (macOS 13 Ventura / macOS 14 Sonoma / macOS 15 Sequoia on Apple Silicon ARM64)
  • Hardware Specifications and Constraints

Standard hosted VMs provide 2 vCPUs , 7 GB of RAM , and approximately 10 GB to 14 GB of available SSD storage space for private projects.

Execution Time Limits :

Private projects: Maximum of 60 minutes per job on free tier, or 360 minutes (6 hours) with paid parallel jobs.

Public projects: Maximum of 360 minutes (6 hours) per job.

Fundamental Limitations

No Direct Private Network Connectivity : Hosted agents reside in dynamic public Azure subnets. They cannot natively reach internal on-premises databases, private Active Directory domain controllers, or Azure resources secured behind Azure Private Endpoints or Virtual Network (VNet) service endpoints.

Dynamic Public IP Addresses : Hosted agents do not possess static IP addresses. Their outbound IPs are drawn from broad weekly Azure Datacenter IP ranges. Whitelisting these IP ranges on corporate perimeter firewalls is impractical and violates security best practices.

Compute and Disk Caps : Workloads requiring heavy parallel compilations (e.g., massive C++ monoliths, game engines, or multi-gigabyte container image layers) often fail due to disk exhaustion or CPU throttling.

No Inter-Job Caching : Unless pipelines explicitly use caching tasks ( Cache@2 or actions/cache@v4 ), package dependencies must be downloaded from the internet on every run.

2. Self-Hosted Agents & Runners

When hosted agents cannot meet security, network, or performance requirements, organizations deploy Self-Hosted Agents (Azure DevOps) or Self-Hosted Runners (GitHub Actions).

Architecture & Operating System Support

A self-hosted agent is a persistent compute instance (physical server, on-premises VMware/Hyper-V virtual machine, or cloud IaaS VM) managed entirely by the customer. The core agent application is a lightweight, cross-platform .NET application running on:

Linux : Ubuntu, Red Hat Enterprise Linux, Debian, CentOS (configured as a systemd background service).

Windows : Windows 10/11 or Windows Server (configured as a standard Windows Service ).

macOS : macOS 12+ running on Intel or Apple Silicon (configured as a launchd service).

Network Communication Model (Crucial Exam Concept!)

A frequent misconception on the AZ-400 exam is that self-hosted agents require inbound firewall ports to receive jobs from Azure DevOps. This is completely false. [Corporate Private Network / VNet] [Public Cloud]

  • ┌──────────────────────────────────────┐ ┌───────────────────────────┐
  • │ Self-Hosted Agent VM │ │ Azure DevOps Services │
  • │ ┌────────────────────────────────┐ │ │ (dev.azure.com) │
  • │ │ Agent Listener Process (.NET) │ │ │ │
  • │ └───────────────┬────────────────┘ │ │ │
  • │ │ │ │ │
  • │ │ Outbound HTTPS │ │ │
  • │ │ Long-Polling │ │ │
  • │ │ (Port 443 ONLY) │ │ │
  • │ ▼ │ │ │
  • │ [Corporate Firewall] ───────┼──HTTPS (TCP 443)──► [Job Dispatch Message Bus]│
  • │ (NO INBOUND PORTS OPEN) │ │ │
  • └──────────────────────────────────────┘ └───────────────────────────┘

Pure Outbound Polling : The self-hosted agent listener initiates an outbound HTTPS connection over TCP port 443 to Azure DevOps ( https://dev.azure.com ) or GitHub ( https://api.github.com ).

Long Polling Message Bus : The agent polls an internal HTTP-based message queue. When a pipeline job matches the agent pool and demands, Azure DevOps returns the job details in the HTTP response body.

Zero Inbound Ports : Perimeter firewalls require no inbound openings (no port 80, 443, SSH, or RDP). The agent can reside safely behind corporate NAT and Web Application Firewalls.

Outbound Streaming : Build logs, telemetry, and test results are streamed outbound over the same HTTPS channel.

Corporate Proxy and Custom SSL CA Configuration

In enterprise networks where all outbound internet traffic must route through an inspecting forward proxy:

Proxy Settings : Configured during agent setup or via the .proxy file in the agent root directory: http://proxy.corp.contoso.com:8080 If authentication is required: http://user:password@proxy.corp.contoso.com:8080 .

Bypassing Proxy : Configured in .proxybypass for intranet addresses.

Custom Certificate Authority (CA) : When SSL inspection proxies terminate TLS traffic, the agent must trust the corporate root certificate. The certificate is placed in the OS trust store, and the agent is started with the --sslcacert parameter pointing to the PEM bundle, or configured via the NODE_EXTRA_CA_CERTS environment variable.

Operational Burdens: The "Dirty State" Problem

Unlike hosted agents, self-hosted agents are persistent. If a build script leaves temporary files, alters registry keys, installs packages globally, or crashes mid-execution, subsequent jobs inherit that modified environment. DevOps engineers must explicitly configure workspace cleaning ( checkout: self, clean: true ) or schedule maintenance tasks to prevent disk saturation and build non-determinism.

3. Cost, Licensing, Connectivity and Maintainability

The blueprint asks you to design agent infrastructure against four named criteria, so score every option on all four rather than on speed alone.

Criterion Microsoft-hosted / GitHub-hosted Self-hosted

Cost model Per parallel job per month; free tier is 1 Microsoft-hosted parallel job with a 1,800 minute monthly cap for private projects Per parallel job (self-hosted rate) plus the VM, storage, patching and operator time you fund yourself

Licensing Image software licensing is included; no BYOL required You supply and license everything on the image, including any commercial SDK or signing tool

Connectivity Outbound only, from Microsoft IP ranges; cannot reach a private VNet, on-premises database or air-gapped artifact store Runs inside your network; reaches private endpoints, licence servers and on-premises hardware

Maintainability Microsoft refreshes and patches the image; you inherit tool version changes on their schedule You own image drift, tool upgrades, disk hygiene and the "dirty workspace" problem

Two rules resolve most scenario questions:

Any requirement to reach a private resource forces self-hosted (or a VMSS pool inside the VNet). Firewall allowlisting cannot fix a Microsoft-hosted agent, because the agent initiates outbound long-polling to Azure DevOps and never accepts inbound connections.

Any requirement for a clean, guaranteed-identical workspace favours Microsoft-hosted or VMSS with re-imaging. A long-lived self-hosted agent accumulates cached packages, leftover environment variables and stale global tool installs, which is the classic "works on agent 3 but fails on agent 7" defect.

Free-tier and grant mechanics also matter: public projects receive 10 free Microsoft-hosted parallel jobs with no monthly minute cap, while private projects start with one grant-based parallel job. Buying additional self-hosted parallel jobs is far cheaper than Microsoft-hosted ones, which is why large enterprises usually mix a small hosted pool for open-source work with a large self-hosted or VMSS pool for product builds.