microsoft/aspire · error · InvalidOperationException

Emulator currently does not support data lake.

Error message

Emulator currently does not support data lake.

What it means

AzureStorageResource.DataLakeUriExpression returns the data lake endpoint URI for real Azure Storage but deliberately refuses when the resource is the Azurite emulator, since Azurite does not implement the Data Lake Storage (ADLS Gen2) API. The throw is an explicit unsupported-operation guard, not a transient failure.

Solutions

  1. Do not use Data Lake APIs with the emulator — remove DataLake usage from the emulator code path
  2. Run against a real Azure Storage account when data lake access is required
  3. Branch on resource.IsEmulator and provide an alternative (e.g. blob endpoint) for local development

Example fix

// before
var dlUri = storageResource.Resource.DataLakeUriExpression;
// after
if (storageResource.Resource.IsEmulator)
{
    // Azurite has no data lake support; use blob endpoint instead
    var uri = storageResource.Resource.BlobUriExpression;
}
else
{
    var uri = storageResource.Resource.DataLakeUriExpression;
}
Defensive patterns

Strategy: validation

Validate before calling

if (storageResource.IsEmulator)
    throw new NotSupportedException("Data Lake is not supported by the Azurite emulator; use blob endpoints or real Azure Storage.");

Type guard

static bool SupportsDataLake(AzureStorageResource r) => !r.IsEmulator;

Try / catch

try { uri = resource.DataLakeUriExpression; }
catch (InvalidOperationException ex) when (ex.Message.Contains("does not support data lake")) { uri = resource.BlobUriExpression; }

Prevention

When it happens

Trigger: Accessing resource.DataLakeUriExpression (directly or via DataLake connection APIs / GetDataLake...) on a storage resource running with RunAsEmulator(), i.e. IsEmulator == true.

Common situations: An app that works against real Azure Storage is pointed at the local Azurite emulator and a component requests the data lake URI; templated code using DataLake endpoints run in local dev.

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/c00c47fc98cbc752. Report an issue: GitHub.

Appendix: source

Thrown at src/Aspire.Hosting.Azure.Storage/AzureStorageResource.cs:104

    /// <summary>
    /// Gets the connection URI expression for the blob storage service.
    /// </summary>
    /// <remarks>
    /// Format: <c>https://{host}:{port}</c> for emulator or <c>{blobEndpoint}</c> for Azure.
    /// </remarks>
    public ReferenceExpression BlobUriExpression => IsEmulator
        ? ReferenceExpression.Create($"{EmulatorBlobEndpoint.Property(EndpointProperty.Url)}")
        : ReferenceExpression.Create($"{BlobEndpoint}");

    /// <summary>
    /// Gets the connection URI expression for the data lake storage service.
    /// </summary>
    /// <remarks>
    /// Format: <c>{blobEndpoint}</c> for Azure.
    /// </remarks>
    public ReferenceExpression DataLakeUriExpression => IsEmulator
        ? throw new InvalidOperationException("Emulator currently does not support data lake.")
        : ReferenceExpression.Create($"{DataLakeEndpoint}");

    /// <summary>
    /// Gets the connection URI expression for the queue storage service.
    /// </summary>
    /// <remarks>
    /// Format: <c>https://{host}:{port}</c> for emulator or <c>{queueEndpoint}</c> for Azure.
    /// </remarks>
    public ReferenceExpression QueueUriExpression => IsEmulator
        ? ReferenceExpression.Create($"{EmulatorQueueEndpoint.Property(EndpointProperty.Url)}")
        : ReferenceExpression.Create($"{QueueEndpoint}");

    /// <summary>
    /// Gets the connection URI expression for the table storage service.
    /// </summary>
    /// <remarks>
    /// Format: <c>https://{host}:{port}</c> for emulator or <c>{tableEndpoint}</c> for Azure.
    /// </remarks>

View on GitHub (pinned to 25830f84bd)