Skip to content

[Failing test]: Aspire.Hosting.Azure.Tests.AzureDeployerTests fail: the given key 'AZURE_CONTAINER_REGISTRY_NAME' was not present in the dictionary. #11728

@radical

Description

@radical

Is there an existing issue for this?

  • I have searched the existing issues

Build information

Build:

Fill in the error message template

Error Message

Multiple tests in Aspire.Hosting.Azure.Tests.AzureDeployerTests are failing exclusively on Azure DevOps (passing on GitHub Actions workflows) with KeyNotFoundException when trying to access Azure resource configuration keys.

Primary Failures (KeyNotFoundException)

All 7 tests fail with the same root cause - missing Azure resource configuration keys:

  1. DeployAsync_WithMultipleComputeEnvironments_Works (line 370) - Missing: AZURE_CONTAINER_REGISTRY_NAME
  2. DeployAsync_WithContainer_Works (line 188) - Missing: AZURE_CONTAINER_REGISTRY_NAME
  3. DeployAsync_WithProjectResource_Works (line 291) - Missing: AZURE_CONTAINER_REGISTRY_NAME
  4. DeployAsync_WithDockerfile_Works (line 235) - Missing: AZURE_CONTAINER_REGISTRY_NAME
  5. DeployAsync_WithOnlyAzureResources_PrintsDashboardUrl (line 639) - Missing: AZURE_CONTAINER_APPS_ENVIRONMENT_DEFAULT_DOMAIN
  6. DeployAsync_WithSingleRedisCache_CallsDeployingComputeResources (line 589) - Missing: AZURE_CONTAINER_REGISTRY_NAME
  7. DeployAsync_WithAzureFunctionsProject_Works (line 891) - Missing: AZURE_CONTAINER_REGISTRY_NAME

Secondary Failures (Missing Project Files)

2 additional tests failed due to missing test project files:

  • PublishAsAzureAppServiceWebsite_ThrowsIfNoEnvironment
  • MultipleAzureAppServiceEnvironmentsSupported

Stack Trace

System.Collections.Generic.KeyNotFoundException : The given key 'AZURE_CONTAINER_REGISTRY_NAME' was not present in the dictionary.
    at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
    at Aspire.Hosting.Azure.Tests.AzureDeployerTests.DeployAsync_WithMultipleComputeEnvironments_Works() in D:\a\_work\1\s\tests\Aspire.Hosting.Azure.Tests\AzureDeployerTests.cs:line 370
    --- End of stack trace from previous location ---

Similar stack traces occur for other failing tests at different line numbers (188, 235, 291, 589, 639, 891).

Notable Environment Differences (AzDO vs GitHub Actions)

  • Docker Unavailability: Could not harvest all abandoned containers {"Error": "exec: \"docker\": executable file not found in %PATH%"}
  • User Secrets Path Issues (warnings):
warn: Aspire.Hosting.Azure.Provisioning.Internal.DefaultUserSecretsManager[0]
      Failed to save user secrets.
      System.InvalidOperationException: User secrets path could not be determined.

Other info

Test Context and Environment

The tests are using mock Azure provisioning with test credentials:
info: Aspire.Hosting.Azure.Provisioning.Internal.PublishModeProvisioningContextProvider[0]
Default subscription: Test Subscription (/subscriptions/12345678-1234-1234-1234-123456789012)
info: Aspire.Hosting.Azure.Provisioning.Internal.PublishModeProvisioningContextProvider[0]
Tenant: 87654321-4321-4321-4321-210987654321
info: Aspire.Hosting.Azure.Provisioning.Internal.PublishModeProvisioningContextProvider[0]
Using existing resource group test-rg.

Analysis

Root Cause: The tests expect Azure resource configuration keys (primarily AZURE_CONTAINER_REGISTRY_NAME and AZURE_CONTAINER_APPS_ENVIRONMENT_DEFAULT_DOMAIN) to be present in a dictionary during the deployment provisioning phase, but these keys are not being populated in the AzDO/Helix environment.

Report

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
0 0 0

Last 10 failures:

Run date Build Type Test Name OS

Summary

Last 24 hrs Last 7 days Last 30 days Most Affected OS Failure Rate
0 0 0 N/A 0.0%

-- Updated on 10/27/2025 5:54:46 AM UTC

Metadata

Metadata

Assignees

Labels

Azure.ProvisioningIssues with the Azure.Provisioning libraries (nee Azure CDK)area-app-testingIssues pertaining to the APIs in Aspire.Hosting.TestingazureIssues associated specifically with scenarios tied to using Azureblocking-clean-ciBlocking a green CI

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions