Fix Azure AD tenant identifier canonicalization in FAB auth manager - #71920
Conversation
…clarify validation of issuer and audience claims, and support for tenant domain and GUID authorities.
hussein-awala
left a comment
There was a problem hiding this comment.
The approach looks right to me: resolving the tenant’s canonical GUID from the OIDC discovery document, rather than trusting the configured identifier, is what Microsoft’s guidance calls for. It’s also the only way for a domain-name authority or a differently cased GUID to match the iss claim that Azure actually issues.
I requested one fix inline and raised a scope question about sovereign clouds.
Minor for sso.rst: worth noting that the domain-name form triggers an outbound HTTPS call to the discovery endpoint at login time, that matters for egress-restricted deployments, and it's the kind of thing people only find out when it fails.
There was a problem hiding this comment.
Pull request overview
Fixes Azure tenant identifier canonicalization for FAB Azure SSO token validation.
Changes:
- Normalizes GUIDs and resolves tenant domains through OpenID discovery.
- Adds strict endpoint parsing, caching, and fail-closed validation.
- Expands tests and documents supported configurations.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Review summary |
|---|---|
providers/fab/tests/unit/fab/auth_manager/security_manager/test_override.py |
Tenant resolution and JWT validation coverage reviewed. |
providers/fab/src/airflow/providers/fab/auth_manager/security_manager/override.py |
Moderate issue: tenant-agnostic endpoints may prevent checking later valid endpoints. Nit: move the local requests import to module scope. |
providers/fab/docs/auth-manager/sso.rst |
Azure tenant configuration documentation reviewed. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…nts in security manager
related: #71735
Why
In
apache-airflow-providers-fab==3.8.1rc1(#71735), Azure AD token validation uses the configured tenant identifier directly as the expectedissclaim. But Azure mints the issuer published in the tenant's OpenID Connect metadata, which always carries the canonical lowercase tenant GUID-- see Microsoft Entra ID guidance on validating the issuer. Deployments configured with a domain name (e.g.*.onmicrosoft.comor a custom domain) or an uppercase GUID therefore fail login withInvalidClaimError.How to Reproduce
In an environment with
apache-airflow-providers-fab==3.8.1rc1installed, running token validation against domain or uppercase GUID authorities fails:Summary of Changes
_resolve_azure_tenant_guid()to normalize GUIDs locally and resolve domain names to canonical tenant GUIDs via Microsoft OpenID Connect discovery (with in-memory caching).urllib.parse.urlsplitto safely extract configured tenant identifiers from HTTPSlogin.microsoftonline.comendpoints, and addedAzureTenantResolutionError(FabException)for discovery/validation failures.tenant_identifier_resolve_azure_tenant_guidOutput72f988bf-86f1-41af-91ab-2d7cd011db47)72f988bf-86f1-41af-91ab-2d7cd011db4772F988BF-86F1-41AF-91AB-2D7CD011DB47)72f988bf-86f1-41af-91ab-2d7cd011db47microsoft.onmicrosoft.com)72f988bf-86f1-41af-91ab-2d7cd011db47contoso.com)<canonical-tenant-guid>Was generative AI tooling used to co-author this PR?
Generated-by: [GPT 5.6-sol] following the guidelines