Skip to content

Remove DefaultContainerRegistry from model when Foundry project uses explicit registry#16438

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-foundry-default-container-registry
Draft

Remove DefaultContainerRegistry from model when Foundry project uses explicit registry#16438
Copilot wants to merge 2 commits intomainfrom
copilot/fix-foundry-default-container-registry

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 24, 2026

Description

Foundry projects create a default ACR but don't remove it when an explicit registry is specified via WithContainerRegistry, resulting in two ACRs being provisioned instead of one.

Applies the same pattern already used by AKS (AzureKubernetesEnvironmentExtensions.WithContainerRegistry): remove the default registry from the model and null the property when an explicit registry is set.

var acr = builder.AddAzureContainerRegistry("acr");
var foundry = builder.AddFoundry("foundry");
foundry.AddProject("my-project")
    .WithContainerRegistry(acr); // now correctly removes the default ACR

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
    • No
  • Does the change require an update in our Aspire docs?
    • Yes
    • No

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 7k6vsblobprodcus337.vsblob.vsassets.io
    • Triggering command: /usr/share/dotnet/dotnet dotnet build src/Aspire.Hosting.Foundry/Aspire.Hosting.Foundry.csproj (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

…specified via WithContainerRegistry

Agent-Logs-Url: https://github.com/microsoft/aspire/sessions/1688cd78-a313-47c9-ba2a-ec06a7f330b8

Co-authored-by: eerhardt <8291187+eerhardt@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix foundry projects to remove default container registry Remove DefaultContainerRegistry from model when Foundry project uses explicit registry Apr 24, 2026
Copilot AI requested a review from eerhardt April 24, 2026 17:20
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.

Foundry Projects don't remove their DefaultContainerRegistry when another is specified

2 participants