microsoft/aspire · error · InvalidOperationException

Emulator currently does not support data lake.

Error message

Emulator currently does not support data lake.

What it means

RunAsEmulator refuses to emulate an Azure Storage resource that has hierarchical namespace (HNS/data lake) enabled, because no emulator supports data lake features. It throws InvalidOperationException before creating the emulator container when IsHnsEnabled is true.

Solutions

  1. Disable HNS on the resource before calling RunAsEmulator
  2. Use a real Azure Storage account when data lake/HNS features are required
  3. Split into two resources: an emulated storage for blob/queue and a real account for data lake

Example fix

// before
var storage = builder.AddAzureStorage("storage").WithHnsEnabled().RunAsEmulator(); // throws
// after
var storage = builder.AddAzureStorage("storage"); // real account keeps HNS enabled
Defensive patterns

Strategy: validation

Validate before calling

if (storage.Resource.IsHnsEnabled)
    throw new InvalidOperationException("Cannot run storage emulator with HNS/data lake enabled.");

Try / catch

try { storage.RunAsEmulator(); }
catch (InvalidOperationException) { // HNS enabled: use real account instead
    storage = builder.AddAzureStorage("storage-real");
}

Prevention

When it happens

Trigger: Calling RunAsEmulator on an AzureStorageResource builder after enabling HNS (e.g. via configuration enabling data lake features) on the storage resource.

Common situations: Configuring the storage account for Data Lake Gen2 (IsHnsEnabled) for production but attempting local emulation; shared resource configuration reused across emulator and real-account setups.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16). Data as JSON: /api/errors/0b965ed2f9d74c25. Report an issue: GitHub.

Appendix: source

Thrown at src/Aspire.Hosting.Azure.Storage/AzureStorageExtensions.cs:187

    /// <summary>
    /// Configures an Azure Storage resource to be emulated using Azurite. This resource requires an <see cref="AzureStorageResource"/> to be added to the application model.
    /// </summary>
    /// <ats-summary>Configures the Azure Storage resource to be emulated using Azurite</ats-summary>
    /// <remarks>
    /// This version of the package defaults to the <inheritdoc cref="StorageEmulatorContainerImageTags.Tag"/> tag of the <inheritdoc cref="StorageEmulatorContainerImageTags.Registry"/>/<inheritdoc cref="StorageEmulatorContainerImageTags.Image"/> container image.
    /// </remarks>
    /// <param name="builder">The Azure storage resource builder.</param>
    /// <param name="configureContainer">Callback that exposes underlying container used for emulation to allow for customization.</param>
    /// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
    /// <ats-returns>The resource builder.</ats-returns>
    [AspireExport(RunSyncOnBackgroundThread = true)]
    public static IResourceBuilder<AzureStorageResource> RunAsEmulator(this IResourceBuilder<AzureStorageResource> builder, Action<IResourceBuilder<AzureStorageEmulatorResource>>? configureContainer = null)
    {
        ArgumentNullException.ThrowIfNull(builder);
        if (builder.Resource.IsHnsEnabled)
        {
            throw new InvalidOperationException("Emulator currently does not support data lake.");
        }

        if (builder.ApplicationBuilder.ExecutionContext.IsPublishMode)
        {
            return builder;
        }

        // Mark this resource as an emulator for consistent resource identification and tooling support
        builder.WithAnnotation(new EmulatorResourceAnnotation());

        builder.WithHttpEndpoint(name: "blob", targetPort: 10000)
               .WithHttpEndpoint(name: "queue", targetPort: 10001)
               .WithHttpEndpoint(name: "table", targetPort: 10002)
               .WithAnnotation(new ContainerImageAnnotation
               {
                   Registry = StorageEmulatorContainerImageTags.Registry,
                   Image = StorageEmulatorContainerImageTags.Image,
                   Tag = StorageEmulatorContainerImageTags.Tag

View on GitHub (pinned to 25830f84bd)