Skip to content

Azurite emulator needs --looseBlobEndpoint for container-to-container access #14044

@davidfowl

Description

@davidfowl

Describe the bug

When a container resource (e.g., AddDockerfile) references Azure Storage running as emulator, the injected connection string uses storage.dev.internal as the hostname. However, Azurite does not recognize this hostname and returns 404 ResourceNotFound errors.

The same request works when using the actual container name directly (e.g., storage-abc123):

  • storage.dev.internal:10000 → 404 ResourceNotFound
  • storage-abc123:10000 → 403 AuthorizationFailure (container exists, just needs auth)

Root Cause

Azurite uses hostname-based account routing. The DNS alias storage.dev.internal is not recognized as belonging to devstoreaccount1.

Note: The --loose flag does NOT fix this issue. It only ignores unsupported headers/parameters, not hostname routing.

Workaround

Override the connection string in the client integration to use the actual container name:

builder.AddAzureBlobContainerClient("workspaces", settings =>
{
    var connStr = builder.Configuration.GetConnectionString("workspaces");
    if (connStr?.Contains("storage.dev.internal") == true)
    {
        // Replace with actual container hostname
        connStr = connStr.Replace("storage.dev.internal", "storage-actualname");
    }
});

Expected Behavior

Aspire should either:

  1. Use the actual container name in connection strings for container-to-container networking
  2. Configure Azurite to recognize the storage.dev.internal alias

Steps To Reproduce

  1. Create an AppHost with Azure Storage emulator
  2. Add a Dockerfile-based resource that references the storage
  3. The container gets connection string with BlobEndpoint=http://storage.dev.internal:10000/devstoreaccount1
  4. Blob operations fail with 404 ResourceNotFound

Environment

  • .NET 10 Preview
  • Aspire 13.x
  • Docker Desktop on macOS

Metadata

Metadata

Assignees

Labels

area-integrationsIssues pertaining to Aspire Integrations packages‼️regression-from-last-releaseThis used to work in an earlier version of Aspire and we broke it!

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions