Skip to content

Let self-hosted Azure agents provide the registry through VM tags - #8

Merged
olljanat-ai merged 1 commit into
mainfrom
claude/tender-meitner-ajhg0z
Nov 12, 2026
Merged

olljanat-ai merged 1 commit into
mainfrom
claude/tender-meitner-ajhg0z

Conversation

@olljanat-ai

Copy link
Copy Markdown
Member

Summary

Self-hosted agents and runners can now provide everything the build needs, so a pipeline is only - task: ContainerBuild@0:

Managed DevOps Pools have no setting for agent environment variables, but their docs state that the pool "passes up to 20 tags to the virtual machine". So tagging the pool configures every agent. The same works for VM scale set agents, your own VMs and GitHub runners on Azure VMs. CONTAINER_REGISTRY in the agent's environment (agent or runner .env, pod spec) still works too.

Changes

  • Registry precedence: input > CONTAINER_REGISTRY > service connection > VM tag > ghcr.io (GitHub). The GitHub default moved to a new getFallbackRegistry() so that a VM tag wins over it.
  • IMDS is queried only when the pipeline doesn't configure a registry. The result is cached, and a failure counts as "no tags".
  • The Managed DevOps Pool example now tags the pool with the registry and the identity's client id, and no longer uses a variable group. The pool moved to pool.bicep, because tags must be known when the deployment starts.
  • The Marketplace overview and the README now lead with the zero-config self-hosted setup. Service connections and variable groups are described as the option for Microsoft-hosted agents. The README also notes that ACR, GHCR and most registries allow nested paths, unlike Docker Hub.

Testing

  • 83 unit tests, including tag parsing (name normalization, caching, no tags outside Azure), precedence against variables and the GitHub fallback, and client-id selection from the tag for the managed identity token request.
  • Real IMDS path: a fake metadata server at 169.254.169.254 on a Docker network, called by the bundled machineSettings code with real curl, returned {"registry":"localhost:5000"}. Without the server, or with the traffic dropped, it returned {} in about 40 ms.
  • bicep build is clean, and the compiled template shows the tags on the Microsoft.DevOpsInfrastructure/pools resource.
  • Not verified on a real Managed DevOps Pool. Tag propagation relies on the Microsoft documentation quoted above.

Generated by Claude Code

The task reads the 'container-registry' (and optional
'container-registry-client-id') tag of the agent VM from the instance
metadata service. Managed DevOps Pools pass pool tags to their agents,
so together with the agent's managed identity, pipelines need nothing
but '- task: ContainerBuild@0'. The same works for VM scale set agents
and GitHub runners on Azure VMs.

- Registry precedence: input > CONTAINER_REGISTRY > service connection >
  VM tag > ghcr.io (GitHub)
- Managed DevOps Pool example tags the pool (pool moved to a module)
  and drops the variable group
- Docs lead with the zero-config self-hosted setup

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HpAsQazVvi679PqLz7o1C1
@olljanat-ai
olljanat-ai merged commit ba257e1 into main Nov 12, 2026
7 checks passed
@olljanat-ai olljanat-ai mentioned this pull request Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants