Skip to content

[New article]: Document Azure Container Registry hosting integration #3222

@captainsafia

Description

@captainsafia

Proposed topic or title

Azure Container Registry

Location in table of contents.

/ Integrations / Azure / Container registry

Reason for the article

We're adding a new hosting integration for Azure Container Registry in Aspire that's designed for integration with our compute environments. It allows you to reference existing Azure container registries in your app.

Article abstract

Aspire apps often build and run container images locally but must pull from a secure registry in staging/production.

The new helpers let you:

  • Provision or reference an existing Azure Container Registry.
  • Attach that registry to any compute-environment resource (Container Apps, Docker, Kubernetes, etc.) so the right credentials flow automatically.
  • Grant fine-grained ACR role assignments to other Azure resources.

The feature can be used as follows. In the case below, a new container registry will be provisioned and used as the registry for the default container app environment that is generated.

var builder = DistributedApplication.CreateBuilder(args);

//  Add (or reference) the registry
var acr = builder.AddAzureContainerRegistry("myacr");

//  Wire an environment to that registry
builder.AddAzureContainerAppsEnvironment("env")
       .WithAzureContainerRegistry(acr);

//  (Optional) let a service **push** images
builder.AddProject("api", "../Api/Api.csproj")
       .WithRoleAssignments(acr, ContainerRegistryBuiltInRole.AcrPush);

await builder.Build().RunAsync();

This feature also works in conjunction with the existing resources feature. You can use the following format to reference an existing container registry:

var builder = DistributedApplication.CreateBuilder(args);

var registryName = builder.AddParameterResource("registryName");
var rename = builder.AddParameterResource("rgName");

//  Add (or reference) the registry
var acr = builder.AddAzureContainerRegistry("myacr")
        .PublishAsExisting(registryName, rgName);

//  Wire an environment to that registry
builder.AddAzureContainerAppsEnvironment("env")
       .WithAzureContainerRegistry(acr);

await builder.Build().RunAsync();

Relevant searches

No response


Associated WorkItem - 429903

Metadata

Metadata

Assignees

Labels

📌 seQUESTeredIdentifies that an issue has been imported into Quest.Pri1High priority, do before Pri2 and Pri3area-docsdoc-ideaIndicates issues that are suggestions for new topics [org][type][category]

Type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions