dotnet/orleans · critical · InvalidOperationException
Configure AzureTable:ServiceUri for Azure, or use Azurite wi
Error message
Configure AzureTable:ServiceUri for Azure, or use Azurite with AzureTable:ConnectionString=UseDevelopmentStorage=true in Development.
What it means
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.
Source
Thrown at samples/Deployment/AzureContainerApps/Infrastructure/AzureTableServiceClientFactory.cs:41
var managedIdentityClientId = GetRequiredValue(configuration, "AZURE_CLIENT_ID");
if (!Guid.TryParse(managedIdentityClientId, out _))
{
throw new InvalidOperationException(
"AZURE_CLIENT_ID must contain the user-assigned managed identity client ID.");
}
credentialOptions.ManagedIdentityClientId = managedIdentityClientId;
return new TableServiceClient(serviceUri, new DefaultAzureCredential(credentialOptions));
}
var connectionString = configuration["AzureTable:ConnectionString"];
if (environment.IsDevelopment()
&& string.Equals(connectionString, "UseDevelopmentStorage=true", StringComparison.OrdinalIgnoreCase))
{
return new TableServiceClient(connectionString);
}
throw new InvalidOperationException(
"Configure AzureTable:ServiceUri for Azure, or use Azurite with "
+ "AzureTable:ConnectionString=UseDevelopmentStorage=true in Development.");
}
public static string GetRequiredValue(IConfiguration configuration, string key)
{
var value = configuration[key];
return !string.IsNullOrWhiteSpace(value)
? value
: throw new InvalidOperationException($"{key} is not configured.");
}
}
View on GitHub (pinned to fca799fa70)
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.
Example fix
// before (config missing both)
"AzureTable": {}
// after (local dev)
"AzureTable": { "ConnectionString": "UseDevelopmentStorage=true" }
// or (cloud)
"AzureTable": { "ServiceUri": "https://myaccount.table.core.windows.net" } Defensive patterns
Strategy: validation
Validate before calling
var hasUri = !string.IsNullOrWhiteSpace(configuration["AzureTable:ServiceUri"]);
var hasDevConn = environment.IsDevelopment()
&& string.Equals(configuration["AzureTable:ConnectionString"], "UseDevelopmentStorage=true", StringComparison.OrdinalIgnoreCase);
if (!hasUri && !hasDevConn)
throw new InvalidOperationException("Configure AzureTable:ServiceUri (cloud) or AzureTable:ConnectionString=UseDevelopmentStorage=true (dev)."); Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- {key} is not configured.
- AzureTable:ServiceUri must be an absolute HTTPS Azure Table
- AZURE_CLIENT_ID must contain the user-assigned managed ident
- Orleans:AdvertisedIPAddress must contain the Container Apps
- {key} must be a valid TCP port.
AI-assisted analysis of dotnet/orleans@fca799fa70 (2026-08-13).
Data as JSON: /api/errors/6c387e1357176c15.
Report an issue: GitHub.