Run Windows jobs on your Azure subscription

A runner pool that starts a licensed Windows Server spot VM in your own Azure subscription for every Windows job, signed in without a stored secret.

Last updated 26 November 2026View as Markdown

An Azure runner pool runs each job with runs-on: windows-latest (or another label the pool carries) in a fresh Windows Server 2025 Datacenter: Azure Edition spot VM in your Azure subscription. The Windows licence is part of Azure's price. The VM exists for that one job and is deleted afterwards with its network interface, public IP address and disk. Azure bills your subscription for the VMs; Deutsche Cloud stores no Azure secret.

The pool signs in to Azure with workload identity federation: Deutsche Cloud signs a short-lived token, and your Entra app registration accepts it because you told it to trust exactly that issuer, subject and audience.

Prerequisites

  • ci:CreateRunnerPool on all of CI (rn:ews::<organization id>:ci:*).
  • In Azure: a resource group for the pool, and an app registration in Microsoft Entra ID.
  • On the resource group, the app registration needs the roles Virtual Machine Contributor and Network Contributor, and write access to Compute Galleries (for example a custom role with Microsoft.Compute/galleries/*), or Contributor on that resource group alone.
  • Quota for spot vCPUs of the VM size's family in the region (4 per job for Standard_D4as_v5).
  • The resource providers Microsoft.Compute and Microsoft.Network registered in the subscription. A role on the resource group cannot register them, so register them once in the subscription's resource providers. If either is missing, the pool's error names it and says how to register it. The pool continues by itself once both show as registered.

Create the pool

POST /ci/api/runner-pools/azure
{
  "name": "windows",
  "labels": ["windows-latest", "windows-2025", "windows-2022"],
  "maxSize": 4,
  "monthlyCloudCapEur": 200,
  "azure": {
    "tenantId": "8f3c2a10-5b7e-4d21-9a6c-1e2f3a4b5c6d",
    "clientId": "2b9e7d41-0c3f-4a58-b1d2-6e7f8a9b0c1d",
    "subscriptionId": "5d4c3b2a-1f0e-4d9c-8b7a-6f5e4d3c2b1a",
    "resourceGroup": "ews-ci-windows"
  }
}

tenantId is the app registration's directory (tenant) ID, clientId its application (client) ID, and subscriptionId the subscription the VMs are billed to.

The answer is 201 with the pool. Its azure.federatedCredential holds the issuer, subject and audiences your app registration must trust.

When omitted, region is germanywestcentral, vmSize is Standard_D4as_v5, spot is true with maxPricePerHour -1 (up to the pay-as-you-go price), osDiskType is Premium_LRS, and baseImage is MicrosoftWindowsServer:WindowsServer:2025-datacenter-azure-edition:latest.

  • 400 "A Windows runner cannot carry the label ubuntu-latest: it would be sent Linux or macOS jobs."
  • 409 "A runner pool named windows exists".
  • 404 "Runner group not found".

Trust the pool in Entra

  1. In the Azure portal, open the app registration, then "Certificates & secrets", then "Federated credentials", and add a credential.
  2. For the scenario, choose "Other issuer".
  3. Enter the pool's issuer and subject exactly, and set the audience to api://AzureADTokenExchange.

Until this is done, the pool's lastScaleReason says Azure sign-in refused: invalid_client: AADSTS700213.

Result

On its first pass the pool builds its own image in a Compute Gallery named ews_runners in the resource group: one regular VM from the base image installs the tools (about 40 minutes), is captured, and is deleted. Jobs wait for the image. The pool rebuilds it when its tools change and every month.

Then every waiting job gets one VM, up to maxSize at once. The run page shows where a job ran, for example azure germanywestcentral Standard_D4as_v5 spot (ews-windows-1a2b3c4d).

  • If Azure takes a spot VM back while its job runs, the job starts again on a new VM, once. A second eviction fails the job with that reason.

  • If Azure refuses a VM (no spot capacity, quota), the job keeps waiting and the pool's lastScaleReason says what Azure answered.

  • Without spot quota, run the pool on regular on-demand VMs. On-demand VMs use the size family's regular quota and cost about five times as much, and no eviction applies:

    dcloud ci runner-pools update <pool id> --azure '{"spot":false}'

    Switch back with {"spot":true}. VMs already running keep their kind; the next ones follow.

  • A VM whose runner has not taken its job within 20 minutes is deleted and the job given to the next one.

The image has the same tools as the platform's Windows runners (see Run Windows jobs), and services:, container: and docker:// actions are refused there too.

Cost

Each VM counts toward the pool's and the organization's monthly cap (see Cap cloud spend) by the started minute at azure.hourlyEur, 0.39 euros an hour by default: the pay-as-you-go price of Standard_D4as_v5 with Windows, its disk and its IP address, which a spot VM never exceeds. Azure bills your subscription for what the VMs, disks, addresses and the gallery image actually cost.

Did this page help you?