KB: Azure ACA Container fails to start (no User Assigned or Delegated Managed Identity found for specified ClientId)
When deploying secure workloads using Azure Container Apps (ACA), teams often face confusion between User Assigned Managed Identities (UAMI) and App Registrations. While both entities are visible in Azure Active Directory and have similar identifiers (Application ID, Object ID), they serve very different purposes. This confusion can lead to authentication failures when accessing services like Azure App Configuration or Key Vault.
A common issue occurs when a container app is configured with a managed identity, but the environment variables or role assignments mistakenly reference an App Registration instead, causing errors like:
"No User Assigned or Delegated Managed Identity found for specified ClientId"
This article breaks down the difference between UAMI and App Registrations, explains why this issue happens, and outlines the correct approach to resolve it.
Symptoms
-
Azure Container App fails to authenticate to Azure App Configuration or other services.
-
Logs show:
No User Assigned or Delegated Managed Identity found for specified ClientId
Azure.RequestFailedException: Service request failed
2. Root Cause
-
Misconfigured environment variables (
AZURE_CLIENT_ID) or IAM role assignments refer to an App Registration (client application) instead of the correct User Assigned Managed Identity. -
The system tries to authenticate using the wrong identity, resulting in token acquisition failure.
3. Key Concepts
🔹 User Assigned Managed Identity (UAMI)
-
Managed by Azure and used only by Azure resources.
-
No client secrets or certificates.
-
Used for workload identity (e.g., accessing Azure Key Vault, App Configuration).
-
Identified by:
AZURE_CLIENT_ID = <UAMI client ID>
🔹 App Registration
-
Represents custom-built apps registered in Azure AD.
-
Used for interactive login, delegated access, or API exposure.
-
Requires explicit credentials (certificates or client secrets).
-
Not used for container-based managed identity flows.
4. Resolution Steps
-
Verify the correct UAMI is assigned to the Container App in the "Identity" section.
-
Ensure only the UAMI's Client ID is set in the
AZURE_CLIENT_IDenvironment variable (optional but required when UAMI is used). -
Grant the appropriate IAM role (e.g.,
App Configuration Data Reader) to the UAMI at the target resource. -
Do not use App Registration Client ID or credentials when relying on Managed Identity authentication.
5. Best Practices
-
Always validate that the identity used in code/config matches the one assigned in the portal.
-
Use
DefaultAzureCredentialfor token acquisition; it automatically handles managed identities in ACA. -
Only use
App Registrationswhen building apps that require interactive user login or multi-tenant access.
{"statusCode":400,"message":"No User Assigned or Delegated Managed Identity found for specified ClientId/ResourceId/PrincipalId","correlationId":"9f0191d4-e87c-4994-93cc-af6c28fa4181"}
Ensure to set the env var:
AZURE_CLIENT_ID = <client ID of your user-assigned managed identity>
Comments
Post a Comment