{"record":{"id":"0b965ed2f9d74c25","repo":"microsoft/aspire","slug":"emulator-currently-does-not-support-data-lake-0b965e","errorCode":null,"errorMessage":"Emulator currently does not support data lake.","messagePattern":"Emulator currently does not support data lake\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.Azure.Storage/AzureStorageExtensions.cs","lineNumber":187,"sourceCode":"\n    /// <summary>\n    /// Configures an Azure Storage resource to be emulated using Azurite. This resource requires an <see cref=\"AzureStorageResource\"/> to be added to the application model.\n    /// </summary>\n    /// <ats-summary>Configures the Azure Storage resource to be emulated using Azurite</ats-summary>\n    /// <remarks>\n    /// 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.\n    /// </remarks>\n    /// <param name=\"builder\">The Azure storage resource builder.</param>\n    /// <param name=\"configureContainer\">Callback that exposes underlying container used for emulation to allow for customization.</param>\n    /// <returns>A reference to the <see cref=\"IResourceBuilder{T}\"/>.</returns>\n    /// <ats-returns>The resource builder.</ats-returns>\n    [AspireExport(RunSyncOnBackgroundThread = true)]\n    public static IResourceBuilder<AzureStorageResource> RunAsEmulator(this IResourceBuilder<AzureStorageResource> builder, Action<IResourceBuilder<AzureStorageEmulatorResource>>? configureContainer = null)\n    {\n        ArgumentNullException.ThrowIfNull(builder);\n        if (builder.Resource.IsHnsEnabled)\n        {\n            throw new InvalidOperationException(\"Emulator currently does not support data lake.\");\n        }\n\n        if (builder.ApplicationBuilder.ExecutionContext.IsPublishMode)\n        {\n            return builder;\n        }\n\n        // Mark this resource as an emulator for consistent resource identification and tooling support\n        builder.WithAnnotation(new EmulatorResourceAnnotation());\n\n        builder.WithHttpEndpoint(name: \"blob\", targetPort: 10000)\n               .WithHttpEndpoint(name: \"queue\", targetPort: 10001)\n               .WithHttpEndpoint(name: \"table\", targetPort: 10002)\n               .WithAnnotation(new ContainerImageAnnotation\n               {\n                   Registry = StorageEmulatorContainerImageTags.Registry,\n                   Image = StorageEmulatorContainerImageTags.Image,\n                   Tag = StorageEmulatorContainerImageTags.Tag","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.Azure.Storage/AzureStorageExtensions.cs#L169-L205","documentation":"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.","triggerScenarios":"Calling RunAsEmulator on an AzureStorageResource builder after enabling HNS (e.g. via configuration enabling data lake features) on the storage resource.","commonSituations":"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.","solutions":["Disable HNS on the resource before calling RunAsEmulator","Use a real Azure Storage account when data lake/HNS features are required","Split into two resources: an emulated storage for blob/queue and a real account for data lake"],"exampleFix":"// before\nvar storage = builder.AddAzureStorage(\"storage\").WithHnsEnabled().RunAsEmulator(); // throws\n// after\nvar storage = builder.AddAzureStorage(\"storage\"); // real account keeps HNS enabled","handlingStrategy":"validation","validationCode":"if (storage.Resource.IsHnsEnabled)\n    throw new InvalidOperationException(\"Cannot run storage emulator with HNS/data lake enabled.\");","typeGuard":null,"tryCatchPattern":"try { storage.RunAsEmulator(); }\ncatch (InvalidOperationException) { // HNS enabled: use real account instead\n    storage = builder.AddAzureStorage(\"storage-real\");\n}","preventionTips":["Never enable HNS on resources intended for emulation","Check IsHnsEnabled before calling RunAsEmulator","Keep emulator and real-account resource definitions separate"],"tags":["azure","storage","emulator","hns","datalake"],"backgroundTag":"unsupported-operation","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}