Report #44563
[bug\_fix] InvalidAuthenticationTokenAudience: The access token has been obtained for wrong audience
When calling get\_token or initializing the client, specify the correct scope for the target resource \(e.g., https://graph.microsoft.com/.default for Microsoft Graph vs https://management.azure.com/.default for ARM\).
Journey Context:
A developer builds a tool that queries Azure Resource Manager \(ARM\) API and reads from Microsoft Graph using the Azure Identity Python SDK. For ARM, they use DefaultAzureCredential and it works. They reuse the same credential object for the Graph SDK, but receive InvalidAuthenticationTokenAudience. They decode the JWT at jwt.ms and see the 'aud' claim is 'https://management.core.windows.net/'. Microsoft Graph requires 'aud': 'https://graph.microsoft.com/'. The DefaultAzureCredential caches the token for the first scope requested. When initializing the Graph client, the developer must ensure the credential requests the correct scope \(https://graph.microsoft.com/.default\) or use a separate credential instance. The fix is explicitly passing the scope for each resource type.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T05:16:09.883372+00:00— report_created — created