Skip to content

Self-Hosted Azure DevOps Agents on Hetzner Cloud - Overview

Introduction

This guide provides a comprehensive overview of setting up and managing self-hosted Azure DevOps agents on Hetzner Cloud. Self-hosted agents solve common issues with Microsoft-hosted agents, including:

  • Disk space limitations: Full control over storage allocation
  • Cost optimization: Significant savings for multiple parallel jobs
  • Build performance: Persistent caches and pre-installed dependencies
  • Unlimited job duration: No 60-minute timeout restrictions
  • Custom toolchains: Install exactly what your pipelines need

Architecture

graph TB
    subgraph AzureDevOps["Azure DevOps Organization"]
        Pool1["Hetzner-Linux Pool"]
        Pool2["Hetzner-Windows Pool"]
    end

    subgraph HetznerCloud["Hetzner Cloud"]
        LinuxVM1["Linux Agent 1<br/>Ubuntu 22.04"]
        LinuxVM2["Linux Agent 2<br/>Ubuntu 22.04"]
        WindowsVM1["Windows Agent 1<br/>Windows Server 2022"]
        WindowsVM2["Windows Agent 2<br/>Windows Server 2022"]
    end

    subgraph Pipelines["Azure Pipelines"]
        LinuxPipeline["Linux Pipeline<br/>ubuntu-latest"]
        WindowsPipeline["Windows Pipeline<br/>windows-latest"]
    end

    Pool1 --> LinuxVM1
    Pool1 --> LinuxVM2
    Pool2 --> WindowsVM1
    Pool2 --> WindowsVM2

    LinuxPipeline --> Pool1
    WindowsPipeline --> Pool2
Hold "Alt" / "Option" to enable pan & zoom

Cost Analysis

Infrastructure Costs (Hetzner Cloud)

Monthly Server Costs:

  • Linux Agent (CPX32): ~€12-15/month × 2 = ~€24-30
  • Windows Agent (CCX23): €25.90/month × 2 = €51.80
  • Total Infrastructure: ~€75.80-81.80/month

Additional Costs: - Network traffic: Included (generous limits) - Backups: Optional, ~€2-5/month per server - Monitoring: Optional third-party services - Ollama (Optional): Free - Local AI inference, no API costs. See Ollama Installation Guide

Azure DevOps Costs with Self-Hosted Agents

Self-Hosted Agent Pricing:

  • Free Tier: Unlimited parallel jobs with self-hosted agents
  • No per-job charges: Self-hosted agents do not consume Microsoft-hosted agent minutes
  • Organization costs: Standard Azure DevOps organization fees apply (if applicable)

Microsoft-Hosted Agent Pricing (for comparison):

  • Free Tier: 1,800 minutes/month (shared across all pipelines)
  • Paid Parallel Jobs:
  • 1 parallel job: Free (included with Basic plan)
  • Additional parallel jobs: $40/month per parallel job
  • Example: 4 parallel jobs = $120/month (3 additional × $40)

Cost Comparison Example:

Scenario Microsoft-Hosted Self-Hosted (Hetzner) Savings
1 parallel job $0/month €75.80-81.80/month -€75.80-81.80
2 parallel jobs $40/month €75.80-81.80/month ~€5-10/month
4 parallel jobs $120/month €75.80-81.80/month ~€44-50/month
8 parallel jobs $280/month €151.60-163.60/month (2× servers) ~€128-140/month

Break-even Analysis:

  • Break-even point: ~2 parallel jobs
  • Cost savings: Significant at 4+ parallel jobs
  • Additional benefits:
  • No job duration limits (Microsoft-hosted: 60 minutes on free tier)
  • Full control over disk space and storage
  • Persistent build caches (faster builds)
  • Pre-installed tools and dependencies
  • Local AI inference with Ollama (optional, free, no API costs)

Total Cost of Ownership (TCO)

First Year: - Infrastructure: €75.80-81.80/month × 12 = €909.60-981.60/year - Setup time: ~8-16 hours (one-time) - Maintenance: ~2-4 hours/month

Ongoing: - Infrastructure: €75.80-81.80/month - Maintenance: ~2-4 hours/month - Updates: Included in maintenance time

ROI Calculation: - If using 4+ parallel jobs: Saves ~\(50/month vs Microsoft-hosted - Annual savings: ~\)600/year (€550/year) - Payback period: ~1.5 years (including setup time) - After payback: ~€550/year savings + improved build performance

Implementation Approaches

Option A: Manual Setup

Recommended for: Initial implementation, learning, small teams

Advantages: - Faster initial setup - Better for learning and understanding the system - Easier troubleshooting for first-time setup - No additional tooling required

See: Linux Setup Guide and Windows Setup Guide

Option B: Terraform Setup

Recommended for: Production environments, scaling, infrastructure as code

Advantages: - Infrastructure as Code (version controlled) - Reproducible deployments - Automated scaling and management - Integration with CI/CD pipelines

See: Terraform Setup Guide

Quick Start

  1. Choose implementation approach (Manual or Terraform)
  2. Set up authentication - See Connection and Authentication Guide
  3. Generate SSH keys for Linux servers (recommended)
  4. Get RDP credentials for Windows servers
  5. Purchase Hetzner Cloud servers (Linux and Windows) or set up Terraform configuration
  6. Set up first Linux agent - See Linux Setup Guide
  7. Set up first Windows agent - See Windows Setup Guide
  8. Install Ollama (Optional) - See Ollama Installation Guide if you need AI functionality
  9. Configure Azure DevOps agent pools - See Agent Pools Configuration
  10. Update pipelines to use self-hosted agent pools
  11. Establish monitoring - See Maintenance Guide

Documentation Structure

Server Recommendations

Linux Agents (Ubuntu 22.04 LTS)

  • Recommended: CPX32
  • CPX32: 6 vCPU, 12 GB RAM, 200 GB SSD (~€12-15/month) - Recommended for production
  • Alternative options:
  • CPX31: 4 vCPU, 8 GB RAM, 160 GB SSD (~€8.90/month) - For light builds
  • CPX41: 8 vCPU, 16 GB RAM, 240 GB SSD (~€17.90/month) - For heavy builds
  • For heavy builds: CCX23 (Dedicated CPU, 4 vCPU, 8 GB RAM, 160 GB SSD, ~€25.90/month)

Windows Agents (Windows Server 2022)

  • Minimum: CCX23 (Dedicated CPU required for Windows)
  • 4 vCPU, 8 GB RAM, 160 GB SSD (~€25.90/month)
  • Recommended: CCX33
  • 8 vCPU, 16 GB RAM, 240 GB SSD (~€49.90/month)

Key Benefits

  1. Cost Savings: Break-even at 2 parallel jobs, significant savings at 4+
  2. Performance: Persistent build caches and pre-installed tools
  3. Control: Full control over disk space, storage, and tooling
  4. Flexibility: No job duration limits, custom configurations
  5. Scalability: Easy to add/remove agents as needed

Next Steps

References