{"record":{"id":"6c387e1357176c15","repo":"dotnet/orleans","slug":"configure-azuretable-serviceuri-for-azure-or-use","errorCode":null,"errorMessage":"Configure AzureTable:ServiceUri for Azure, or use Azurite with AzureTable:ConnectionString=UseDevelopmentStorage=true in Development.","messagePattern":"Configure AzureTable:ServiceUri for Azure, or use Azurite with AzureTable:ConnectionString=UseDevelopmentStorage=true in Development\\.","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"critical","filePath":"samples/Deployment/AzureContainerApps/Infrastructure/AzureTableServiceClientFactory.cs","lineNumber":41,"sourceCode":"            var managedIdentityClientId = GetRequiredValue(configuration, \"AZURE_CLIENT_ID\");\n            if (!Guid.TryParse(managedIdentityClientId, out _))\n            {\n                throw new InvalidOperationException(\n                    \"AZURE_CLIENT_ID must contain the user-assigned managed identity client ID.\");\n            }\n\n            credentialOptions.ManagedIdentityClientId = managedIdentityClientId;\n            return new TableServiceClient(serviceUri, new DefaultAzureCredential(credentialOptions));\n        }\n\n        var connectionString = configuration[\"AzureTable:ConnectionString\"];\n        if (environment.IsDevelopment()\n            && string.Equals(connectionString, \"UseDevelopmentStorage=true\", StringComparison.OrdinalIgnoreCase))\n        {\n            return new TableServiceClient(connectionString);\n        }\n\n        throw new InvalidOperationException(\n            \"Configure AzureTable:ServiceUri for Azure, or use Azurite with \"\n            + \"AzureTable:ConnectionString=UseDevelopmentStorage=true in Development.\");\n    }\n\n    public static string GetRequiredValue(IConfiguration configuration, string key)\n    {\n        var value = configuration[key];\n        return !string.IsNullOrWhiteSpace(value)\n            ? value\n            : throw new InvalidOperationException($\"{key} is not configured.\");\n    }\n}\n","sourceCodeStart":23,"sourceCodeEnd":54,"githubUrl":"https://github.com/dotnet/orleans/blob/fca799fa70ecb6ad975224271703ca43221f58de/samples/Deployment/AzureContainerApps/Infrastructure/AzureTableServiceClientFactory.cs#L23-L54","documentation":"An InvalidOperationException thrown by AzureTableServiceClientFactory.Create when neither a valid AzureTable:ServiceUri nor a Development-mode Azurite connection string is configured. The factory has only two valid paths (cloud HTTPS URI, or dev Azurite) and falls through to this terminal error when both are absent.","triggerScenarios":"Startup in an environment where AzureTable:ServiceUri is unset/blank, and either the environment is not Development or AzureTable:ConnectionString is not exactly 'UseDevelopmentStorage=true'. The final else-throw fires.","commonSituations":"Missing configuration in a Production/Staging container app. Running the sample in Production mode locally without providing a cloud URI. The connection string key misspelled so the dev branch never matches.","solutions":["For cloud: set AzureTable:ServiceUri to the https Table endpoint (and AZURE_CLIENT_ID).","For local dev: ensure the environment is Development and AzureTable:ConnectionString=UseDevelopmentStorage=true.","Provide both keys in your deployment manifest so the factory always has a path."],"exampleFix":"// before (config missing both)\n\"AzureTable\": {}\n\n// after (local dev)\n\"AzureTable\": { \"ConnectionString\": \"UseDevelopmentStorage=true\" }\n// or (cloud)\n\"AzureTable\": { \"ServiceUri\": \"https://myaccount.table.core.windows.net\" }","handlingStrategy":"validation","validationCode":"var hasUri = !string.IsNullOrWhiteSpace(configuration[\"AzureTable:ServiceUri\"]);\nvar hasDevConn = environment.IsDevelopment()\n    && string.Equals(configuration[\"AzureTable:ConnectionString\"], \"UseDevelopmentStorage=true\", StringComparison.OrdinalIgnoreCase);\nif (!hasUri && !hasDevConn)\n    throw new InvalidOperationException(\"Configure AzureTable:ServiceUri (cloud) or AzureTable:ConnectionString=UseDevelopmentStorage=true (dev).\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always provide one of the two supported storage paths in every environment.","Keep the dev connection string exactly 'UseDevelopmentStorage=true' (case-insensitive).","Validate storage config in a startup check before building the client."],"tags":["azure-storage","configuration","startup","azure-container-apps","validation"],"backgroundTag":null,"analyzedSha":"fca799fa70ecb6ad975224271703ca43221f58de","analyzedAt":"2026-08-13T19:55:57.938Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}