Skip to content

WithAzureLogAnalyticsWorkspace ignores resource group where the existing LAW is #10973

@wasker

Description

@wasker

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I'm trying to share same existing Log Analytics Workspace between different environments. LAW resource is created in its own resource group.

LAW resource group is "X"; the service environment is deployed to resource group "Y". Deployment fails with an error: "ResourceNotFound: The Resource 'Microsoft.OperationalInsights/workspaces/log-staging-xxxx' under resource group 'Y' was not found."

Expected Behavior

Container App Environment is configured to use shared LAW instance located in a different resource group.

Steps To Reproduce

    var logAnalyticsWorkspaceName = builder.AddParameter("log-env-shared-name");
    var logAnalyticsWorkspaceResourceGroup = builder.AddParameter("log-env-shared-rg"); // "X"
    var logAnalyticsWorkspace = builder
        .AddAzureLogAnalyticsWorkspace("log-env-shared")
        .AsExisting(logAnalyticsWorkspaceName, logAnalyticsWorkspaceResourceGroup);

    _ = builder
        .AddAzureContainerAppEnvironment("app-host") // This will be az provisioned in the RG "Y"
        .WithAzureLogAnalyticsWorkspace(logAnalyticsWorkspace);

    _ = apiProject
        .PublishAsAzureContainerApp();

Exceptions (if any)

No response

.NET Version info

.NET SDK:
Version: 9.0.302
Commit: bb2550b9af
Workload version: 9.0.300-manifests.183aaee6
MSBuild version: 17.14.13+65391c53b

Runtime Environment:
OS Name: Windows
OS Version: 10.0.19045
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.302\

.NET workloads installed:
[maccatalyst]
Installation Source: VS 17.14.36310.24
Manifest Version: 18.5.9207/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.maccatalyst\18.5.9207\WorkloadManifest.json
Install Type: Msi

[ios]
Installation Source: VS 17.14.36310.24
Manifest Version: 18.5.9207/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.ios\18.5.9207\WorkloadManifest.json
Install Type: Msi

[maui-windows]
Installation Source: VS 17.14.36310.24
Manifest Version: 9.0.51/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.maui\9.0.51\WorkloadManifest.json
Install Type: Msi

[android]
Installation Source: VS 17.14.36310.24
Manifest Version: 35.0.78/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.android\35.0.78\WorkloadManifest.json
Install Type: Msi

Configured to use loose manifests when installing new manifests.

Host:
Version: 9.0.7
Architecture: x64
Commit: 3c298d9f00

.NET SDKs installed:
7.0.101 [C:\Program Files\dotnet\sdk]
9.0.302 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 7.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 7.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 7.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.18 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
Not set

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-integrationsIssues pertaining to Aspire Integrations packages

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions