Skip to content

Conversation

@lbussell
Copy link
Member

@lbussell lbussell commented Jan 22, 2026

Fixes #1914.
In draft mode because I haven't ran it through a pipeline to validate yet.

Problem

The current PublishConfiguration tightly couples registry endpoints with authentication details. Each RegistryConfiguration embeds its own ServiceConnection, ResourceGroup, and Subscription, making it difficult to:

  • Share authentication credentials across multiple registries
  • Clearly separate "which registry to use" from "how to authenticate"
  • Support non-ACR registries cleanly

Changes

Refactored PublishConfiguration to separate concerns:

New types:

  • RegistryEndpoint - Holds only the registry server address
  • RegistryAuthentication - Holds ServiceConnection + ACR metadata (ResourceGroup, Subscription)

New schema:

{
  "PublishConfiguration": {
    "BuildRegistry": { "Server": "mybuildregistry.azurecr.io" },
    "PublishRegistry": { "Server": "mypublishregistry.azurecr.io" },
    "RegistryAuthentication": {
      "mybuildregistry.azurecr.io": {
        "ServiceConnection": { "Name": "...", "Id": "...", "TenantId": "...", "ClientId": "..." },
        "ResourceGroup": "<guid>",
        "Subscription": "<guid>"
      }
    }
  }
}

Multiple registries can now share authentication by referencing the same key in RegistryAuthentication.

Files changed:

  • Added RegistryEndpoint.cs, RegistryAuthentication.cs
  • Deleted RegistryConfiguration.cs
  • Updated all consumers to use new lookup via FindRegistryAuthentication()
  • Added PublishConfigurationBindingTests.cs to validate config binding from json.

Breaking change: JSON configuration schema has changed.

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.

ACR authentication can fail when using two different service connections for the same ACR

1 participant