Protego field desk
CI Pipelines: Packages and Testing · part of 50-55% of exam

L10. Runner and Agent Infrastructure: GitHub-Hosted vs Self-Hosted

Course outlineLesson 10 of 18

Choose pipeline execution infrastructure by connectivity, tooling, isolation, limits, and ownership. GitHub-hosted private networking and Azure scale set pools expand the choices beyond a single self-hosted machine.

Hosted and self-hosted execution

Azure Pipelines runs jobs on agents; GitHub Actions runs them on runners. Standard Microsoft-hosted agents and most GitHub-hosted runners provide a fresh VM for each job. The provider maintains the host image, while your team still secures workflow code, permissions, dependencies, and secrets. GitHub's single-CPU hosted runners use containers rather than a dedicated VM.

Self-hosted agents and runners let you control the machine, installed software, network routes, and update schedule. Your team owns patching, hardening, capacity, cleanup, and isolation. Neither model makes untrusted pipeline code safe by itself.

Compare connectivity, tooling, and limits

DecisionMicrosoft-hosted Azure agentGitHub-hosted runnerSelf-hosted machine
Private connectivityNo direct VPN or ExpressRoute connection to your corporate networkPrivate networking options include WireGuard overlays and Azure VNet integrationPossible when you configure routes, DNS, and firewalls
ToolsPreinstalled image plus tools installed during the jobPreinstalled image plus job-time installationCustom image and persistent tool installation
Job limitsHosted job time and parallel-job entitlements applyVM-based hosted jobs allow up to 6 hours; single-CPU containers allow 15 minutes; concurrency depends on account and runner typeService and configured timeout limits still apply; GitHub self-hosted job execution is capped at 5 days
OwnershipProvider manages the host; you secure the pipelineProvider manages the host; you secure the workflowYou secure both the host and pipeline
Choose using connectivity, tool licensing, isolation, job duration, queue time, and total operating cost. Self-hosting is not automatically cheaper. Hosted machines can install additional software during a job; persistence and licensing requirements may still favor self-hosting.

Agent pools, capabilities, and authorization

In Azure DevOps Services, agent pools are organization-scoped and can be shared through project pools. A job uses one agent. For self-hosted agents, capabilities describe the machine and its software, and job demands select an eligible agent. Matching a demand does not authorize a pipeline: restrict pool permissions and pipeline access separately. Pipeline permissions restrict YAML pipelines; Classic pipeline access depends on pool security roles.

Elastic scale set agents

Azure Pipelines can manage a self-hosted pool backed by an Azure Virtual Machine Scale Set. Configure the VM image, network, capacity limits, and standby capacity. Disable Azure VM Scale Set autoscaling so Azure Pipelines controls scaling from queued jobs. Your team still owns the image and its security. Configure reimaging after each job where clean isolation is required.

Ephemeral and persistent isolation

Persistent self-hosted machines can retain workspaces, credentials, caches, and malicious changes. Ephemeral runners reduce cross-job persistence when their environment is destroyed and rebuilt; shared caches and external services still need controls. Merely unregistering a runner does not wipe its machine.

Public fork pull requests can execute attacker-controlled code on a self-hosted machine. Private repositories also require trust boundaries between contributors, workflows, and deployment credentials. Restrict repository and runner-group access, review workflow changes, isolate untrusted builds from privileged deployment pools, and scope tokens narrowly. Approval is one layer, not a substitute for isolation. Exam decision: Use a network-connected self-hosted agent for an on-premises deployment when Microsoft-hosted Azure agents cannot reach the target. For GitHub Actions, also evaluate supported hosted private-networking options before deciding who must operate the runner.

References

Continue Learning

Exam Focus Points
  • ✓Microsoft-hosted Azure agents lack direct corporate VPN or ExpressRoute connectivity; GitHub-hosted runners support configured private networking, and both services enforce job and concurrency limits
  • ✓Self-hosted agents/runners can reach private/on-premises resources and pre-install specific licensed tooling, at the cost of the team owning patching, security hardening, and lifecycle management
  • ✓Key decision factors between hosted and self-hosted are cost at scale, whether specific licensed tools must persist on the machine, network connectivity requirements, and who is responsible for ongoing maintenance
  • ✓Azure DevOps scale set agents back a self-hosted-style agent pool with a VM scale set, combining private network reach with hosted-like elastic auto-scaling
  • ✓Using self-hosted runners with public repositories is a significant security risk, since a malicious pull request from an outside contributor could execute arbitrary code on that self-hosted infrastructure; restricting self-hosted runners to private repos or requiring workflow approval mitigates this
Knowledge Check

1. A pipeline needs to deploy to an on-premises SQL Server that is only reachable from inside the corporate network, which Microsoft-hosted agents cannot reach. What is the appropriate solution?

2. What is a well-documented security risk of enabling self-hosted runners for a public GitHub repository without additional restrictions?

3. What benefit does an Azure DevOps scale set agent pool provide compared to a single, manually managed self-hosted agent VM?