Skip to main content
Self-hosted GitHub runners can significantly reduce CI/CD workflow execution time, especially for build jobs. By caching generic images, build images, and artifacts, build performance can be dramatically improved.

Benefits of Self-Hosted Runners

Faster Builds

Cache images and artifacts for significantly faster build times

Resource Control

Control hardware specs and optimize for your workload

Cost Efficiency

Reduce GitHub Actions minutes usage for large projects

Runner Registration Scope

GitHub runners can be registered at two levels:
  • Organization level - Accessible to all repositories in the organization
  • Repository level - Dedicated to a single repository

Registration URLs

Navigate to:
https://github.com/organizations/{organization}/settings/actions/runners/new

Setup Methods

You can set up self-hosted runners using two approaches:

Azure VM Template

Quick automated setup using Microsoft’s template

Manual Setup

Full control over runner configuration and dependencies

Method 1: Azure VM Template

The fastest way to create self-hosted runners is using the Azure VM template.
1

Access Template

Navigate to https://aka.ms/getbuildagent in a new tab.
2

Configure VM Settings

Enter the following information:
  • Resource Group name - Azure resource group for the VM
  • Region - Azure region for deployment
  • VM Name - Name for your virtual machine
  • Admin Password - Administrator password for VM access
  • Number of agents - How many runners to create on the VM
3

Configure Runner Settings

From the GitHub “Create Self-Hosted Runner” page, copy:
  • Token - Registration token from GitHub
  • Organization URL - Your GitHub organization URL
  • Agent URL - GitHub Actions runner download URL
  • Labels - Set to self-hosted
4

Deploy

Select Review and Create, review the configuration, then choose Create.
5

Verify Registration

Wait for Azure VM creation to complete, then verify the runners appear as registered and ready on GitHub.
The Azure template automatically installs all required dependencies including Docker, PowerShell, Git, and development tools.

Method 2: Manual Setup

For more control over the runner environment, you can set up runners manually.
1

Choose Configuration

On the GitHub runner registration page, select:
  • Runner Image: Windows
  • Architecture: x64
2

Follow Installation Steps

Follow the provided instructions to download and configure the runner on your machine.
3

Install Required Software

Ensure the following software is installed:

Required Dependencies

Install Docker Engine using this script.
Set the EnvScope to Machine if installing Docker with a different user than the one running the agents.

Complete Software List

SoftwarePurposeInstallation Method
Docker EngineContainer runtimePowerShell script
Azure PowerShell ModuleAzure integrationInstall-Module az -force
GitVersion controlchoco install git --force --params "/NoAutoCrlf"
7-ZipArchive extractionchoco install 7zip
GitHub CLIGitHub operationschoco install gh
PowerShell 7.4.1+Scripting runtimechoco install pwsh -y
Visual C++ RedistributableRuntime librarieschoco install vcredist140 -y
.NET RuntimeApplication runtimechoco install dotnet -y
.NET SDKDevelopment SDKchoco install dotnet-sdk -y
If the Deploy Reference Documentation job fails with errors, verify your Git installation configuration. See this issue for details.

Configure Repository Access

Once your runners are set up, configure your repository to use them.
1

Configure Runner Group

On the GitHub runners list, select the Default runner group and allow public repositories if your repository is public.
2

Update AL-Go Settings

Edit your repository settings file at .github/AL-Go-Settings.json and set the gitHubRunner property:
{
  "gitHubRunner": "self-hosted"
}
You can use additional tags like "self-hosted, Windows" to target specific runner types if you have multiple self-hosted runners with different operating systems.
3

Test and Verify

Commit the settings change and monitor your workflows. You should see:
  • Performance improvements on the second run (after cache is populated)
  • Runners picking up workflow jobs
  • Active status on the runner in GitHub settings

Understanding Runner Settings

AL-Go provides two settings to control runner selection:

gitHubRunner vs. runs-on

Used for: Build and test jobs requiring:
  • High memory and CPU
  • Docker container support
  • Longer execution times
{
  "gitHubRunner": "self-hosted"
}
Build jobs benefit most from self-hosted runners due to caching capabilities.

Performance Optimization

Runner Capacity Planning

Based on real-world testing:

Over-allocation Risk

Running 5+ concurrent builds on a single VM causes:
  • 50% slower individual build times
  • High CPU contention
  • Memory pressure

Optimal Configuration

Running 4 concurrent builds provides:
  • Similar performance to single build
  • Good resource utilization
  • Minimal queuing

Performance Tips

1

Disable Real-Time Protection

Turning off Windows Defender real-time protection on self-hosted runners can improve build performance by approximately 25%.
Only disable antivirus protection if your runners are in a secure, isolated network environment.
2

Right-Size Runner Count

Monitor CPU and memory usage to determine optimal runner count:
  • Start with 4 runners per VM
  • Monitor performance during concurrent builds
  • Adjust based on actual workload
3

Use SSD Storage

Docker image caching benefits significantly from fast storage:
  • Use SSD or NVMe storage for runner workspace
  • Allocate sufficient disk space for image cache

Performance Metrics

Typical improvements with self-hosted runners:
MetricGitHub-HostedSelf-Hosted (First Run)Self-Hosted (Cached)
Build TimeBaselineSimilar to baseline50-70% faster
Image DownloadEvery runFirst run onlyCached
Artifact AccessRemoteRemoteLocal cache available

Monitoring Runners

Track runner performance and activity:
1

View Active Jobs

Click on a runner in GitHub settings to see:
  • Current job being executed
  • Job duration
  • Workflow name and run ID
2

Monitor Queue

Check for queued workflows when all runners are busy:
  • Workflows will wait for available runners
  • Consider adding more runners if queuing is frequent
3

Check Resource Usage

Connect to the runner VM to monitor:
  • CPU utilization
  • Memory usage
  • Disk I/O
  • Network activity
Runners show as “Idle” when not executing jobs and “Active” when running workflows. A green status indicator confirms the runner is online and available.

Troubleshooting

Common Issues

Verify:
  • Runner is online and shows “Idle” status
  • Repository has access to the runner group
  • gitHubRunner setting matches runner labels
  • Runner has sufficient disk space
Check:
  • Number of concurrent builds vs. runner capacity
  • CPU and memory usage during builds
  • Antivirus real-time scanning
  • Disk I/O performance
Investigate:
  • Runner service status on the VM
  • Network connectivity to GitHub
  • VM resource availability
  • Registration token expiration

Security Considerations

Important security notes for self-hosted runners:
  • Do not use self-hosted runners with public repositories unless they are in an isolated environment
  • Self-hosted runners can execute arbitrary code from pull requests
  • Use GitHub’s security features to restrict runner access
  • Regularly update runner software and dependencies
  • Monitor runner activity for suspicious behavior

Next Steps

Azure KeyVault Integration

Secure secrets using Azure KeyVault

Enable Telemetry

Monitor runner and workflow performance

Build docs developers (and LLMs) love