Skip to content

Use an existing Log Analytics Workspace when publishing to a Container App Environment #9623

@amilochau

Description

@amilochau

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

Many architectures exist when using Azure Log Analytics Workspace (see here). Today, when using Aspire to publish resources with Azure Container App Environments, a dedicated workspace is deployed. There is no easy way to reference an existing workspace - as we can now do with an existing Azure Container Registry.

Describe the solution you'd like

A first simple solution could be to propose a new extension method, to reference an existing Azure Log Analytics Workspace when defining an explicit Container App Environment, in the AppHost project.

This following code could be used for that:

// Create a custom Log Analytics Workspace
var workspace = builder.AddAzureLogAnalyticsWorkspace("customworkspace");

// Create a container app environment and associate it with the custom workspace
builder.AddAzureContainerAppEnvironment("env")
    .WithAzureLogAnalyticsWorkspace(workspace);

This first solution can be based on the existing assembly Aspire.Hosting.Azure.ContainerRegistry.

Additional context

See this pull request as a proposal for implementing the suggested solution.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions