{"record":{"id":"8d8fb7f317b297c5","repo":"microsoft/aspire","slug":"a-datalakeserviceclient-could-not-be-configured-ensure-valid","errorCode":null,"errorMessage":"A DataLakeServiceClient could not be configured. Ensure valid connection information was provided in 'ConnectionStrings:{connectionName}' or specify a 'ConnectionString' or 'ServiceUri' in the '{configurationSectionName}' configuration section.","messagePattern":"A DataLakeServiceClient could not be configured\\. Ensure valid connection information was provided in 'ConnectionStrings:(.+?)' or specify a 'ConnectionString' or 'ServiceUri' in the '(.+?)' configuration section\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Components/Aspire.Azure.Storage.Files.DataLake/AspireDataLakeExtensions.DataLakeComponent.cs","lineNumber":32,"sourceCode":"\npublic static partial class AspireDataLakeExtensions\n{\n    private sealed class DataLakeComponent\n        : AzureComponent<AzureDataLakeSettings, DataLakeServiceClient, DataLakeClientOptions>\n    {\n        protected override IAzureClientBuilder<DataLakeServiceClient, DataLakeClientOptions> AddClient(\n            AzureClientFactoryBuilder azureFactoryBuilder,\n            AzureDataLakeSettings settings,\n            string connectionName,\n            string configurationSectionName)\n            => ((IAzureClientFactoryBuilderWithCredential)azureFactoryBuilder)\n                .RegisterClientFactory<DataLakeServiceClient, DataLakeClientOptions>(\n                    (options, cred) =>\n                    {\n                        var connectionString = settings.ConnectionString;\n                        if (string.IsNullOrEmpty(connectionString) && settings.ServiceUri is null)\n                        {\n                            throw new InvalidOperationException(\n                                $\"A DataLakeServiceClient could not be configured. Ensure valid connection information was provided in 'ConnectionStrings:{connectionName}' or specify a 'ConnectionString' or 'ServiceUri' in the '{configurationSectionName}' configuration section.\");\n                        }\n\n                        return !string.IsNullOrEmpty(connectionString) ?\n                            new DataLakeServiceClient(connectionString, options) :\n                            cred is not null ? new DataLakeServiceClient(settings.ServiceUri, cred, options) :\n                                new DataLakeServiceClient(settings.ServiceUri, options);\n                    },\n                    requiresCredential: false);\n\n        protected override bool GetHealthCheckEnabled(AzureDataLakeSettings settings) => !settings.DisableHealthChecks;\n\n        protected override bool GetMetricsEnabled(AzureDataLakeSettings settings) => false;\n\n        protected override bool GetTracingEnabled(AzureDataLakeSettings settings) => !settings.DisableTracing;\n\n        protected override TokenCredential? GetTokenCredential(AzureDataLakeSettings settings) => settings.Credential;\n","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Components/Aspire.Azure.Storage.Files.DataLake/AspireDataLakeExtensions.DataLakeComponent.cs#L14-L50","documentation":"Aspire's Azure Data Lake Storage integration throws this when neither ConnectionString nor ServiceUri is configured for DataLakeServiceClient. The Data Lake client needs one of these to locate the storage account; the integration throws a descriptive error rather than letting the SDK fail.","triggerScenarios":"Calling builder.AddAzureDataLakeServiceClient(connectionName) with no 'ConnectionStrings:<connectionName>' entry and no ConnectionString/ServiceUri under 'Aspire:Azure:Storage:Files:DataLake'.","commonSituations":"Missing WithReference in the AppHost for the ADLS resource; connection name typo; running locally with no user secrets configured.","solutions":["Add \"ConnectionStrings\": { \"<name>\": \"<adls connection string or endpoint>\" }","Set \"ServiceUri\": \"https://<account>.dfs.core.windows.net/\" in the config section","Wire the resource in the AppHost: builder.AddAzureDataLakeStorage(\"adls\") then .WithReference(...)","Double-check the connectionName matches the ConnectionStrings key"],"exampleFix":"// before\nbuilder.AddAzureDataLakeServiceClient(\"datalake\"); // key missing\n// after\n\"ConnectionStrings\": { \"datalake\": \"https://acct.dfs.core.windows.net/\" }\n// builder.AddAzureDataLakeServiceClient(\"datalake\");","handlingStrategy":"validation","validationCode":"if (builder.Configuration.GetConnectionString(\"datalake\") is null &&\n    builder.Configuration[\"Aspire:Azure:Storage:Files:DataLake:ServiceUri\"] is null)\n    throw new InvalidOperationException(\"Provide ConnectionStrings:datalake or a ServiceUri for ADLS.\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Reference the ADLS resource from the AppHost","Keep the dfs.core.windows.net ServiceUri in config for standalone runs","Validate config at startup"],"tags":["azure","data-lake","configuration","connection-string"],"backgroundTag":"missing-required-config-field","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"}