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.

@lbussell lbussell self-assigned this Jan 26, 2026
CopyAcrImagesCommand was passing srcResourceId to the wrapper method,
but CopyImagesCommand.ImportImageAsync ignored it and passed null for
srcRegistryName to the service. This caused CopyImageService to set
ResourceId to null, resulting in Azure API 400 errors.

Fix by passing srcRegistryName instead, allowing CopyImageService to
look up the ResourceId from the registry name as designed.
Azure ACR import only accepts one source identifier. Set ResourceId for
ACR-to-ACR imports, or RegistryAddress for external registries, not both.
These CLI options (--acr-subscription, --acr-resource-group) were defined
but never used by BuildCommand. Registry subscription/resource group info
is now provided per-registry via PublishConfiguration.
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