Repository navigation
Let self-hosted Azure agents provide the registry through VM tags - #8
Merged
Merged
Conversation
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
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Self-hosted agents and runners can now provide everything the build needs, so a pipeline is only
- task: ContainerBuild@0:container-registrytag of the agent VM, read from the instance metadata service (/metadata/instance/compute, no permissions needed). An optionalcontainer-registry-client-idtag selects the managed identity when the VM has several.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_REGISTRYin the agent's environment (agent or runner.env, pod spec) still works too.Changes
CONTAINER_REGISTRY> service connection > VM tag >ghcr.io(GitHub). The GitHub default moved to a newgetFallbackRegistry()so that a VM tag wins over it.pool.bicep, because tags must be known when the deployment starts.Testing
169.254.169.254on a Docker network, called by the bundledmachineSettingscode with real curl, returned{"registry":"localhost:5000"}. Without the server, or with the traffic dropped, it returned{}in about 40 ms.bicep buildis clean, and the compiled template shows the tags on theMicrosoft.DevOpsInfrastructure/poolsresource.Generated by Claude Code