Skip to content

BE-477: Add Microsoft/Azure AD OIDC SSO provider#8578

Merged
TimDiekmann merged 2 commits intomainfrom
t/be-477-set-up-microsoftazure-ad-oidc-sso
Apr 2, 2026
Merged

BE-477: Add Microsoft/Azure AD OIDC SSO provider#8578
TimDiekmann merged 2 commits intomainfrom
t/be-477-set-up-microsoftazure-ad-oidc-sso

Conversation

@TimDiekmann
Copy link
Copy Markdown
Member

@TimDiekmann TimDiekmann commented Mar 25, 2026

🌟 What is the purpose of this PR?

Add Microsoft/Azure AD as second OIDC provider, building on the Google SSO foundation from BE-476.

🔗 Related links

🔍 What does this change?

  • Add Microsoft OIDC provider config in kratos.yml
  • Add Jsonnet claims mapper for Microsoft (handles email, preferred_username, upn)
  • Add docker-compose env vars for Microsoft client_id, client_secret, tenant_id

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

This PR:

  • does not modify any publishable blocks or libraries, or modifications do not need publishing

📜 Does this require a change to the docs?

The changes in this PR:

  • are internal and do not require a docs change

🕸️ Does this require a change to the Turbo Graph?

The changes in this PR:

  • do not affect the execution graph

🛡 What tests cover this?

  • Manual testing: Microsoft OIDC login flow on local and staging

❓ How to test this?

Tested and verified on staging with Azure AD accounts.

🎥 Demo

image

@cursor
Copy link
Copy Markdown

cursor bot commented Mar 25, 2026

PR Summary

Medium Risk
Adds a new SSO identity provider and claim-mapping logic in Kratos, which can affect authentication, account linking, and email verification behavior if misconfigured. Changes are mostly additive and gated behind the existing OIDC enable flag.

Overview
Adds Microsoft/Azure AD as an additional OIDC SSO provider for Kratos alongside Google.

Updates kratos.yml to register a microsoft provider (including tenant support) and introduces a new oidc.microsoft.jsonnet mapper that derives the user email from multiple possible Microsoft claims and sets verified_addresses based on email_verified when present.

Extends docker-compose.yml to document and wire Microsoft OIDC client_id, client_secret, and tenant_id environment variables into Kratos’ OIDC provider configuration.

Written by Cursor Bugbot for commit 6dd8021. This will update automatically on new commits. Configure here.

@github-actions github-actions bot added area/apps > hash* Affects HASH (a `hash-*` app) area/apps labels Mar 25, 2026
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hash Ready Ready Preview, Comment Apr 2, 2026 3:50pm
3 Skipped Deployments
Project Deployment Actions Updated (UTC)
hashdotdesign Ignored Ignored Preview Apr 2, 2026 3:50pm
hashdotdesign-tokens Ignored Ignored Preview Apr 2, 2026 3:50pm
petrinaut Skipped Skipped Apr 2, 2026 3:50pm

@augmentcode
Copy link
Copy Markdown

augmentcode bot commented Mar 25, 2026

🤖 Augment PR Summary

Summary: Adds Microsoft/Azure AD (Entra ID) as a second OIDC SSO provider alongside the existing Google OIDC integration.

Changes:

  • Introduces a Microsoft-specific claims mapper (`oidc.microsoft.jsonnet`) to derive the user email from available token claims.
  • Registers the Microsoft OIDC provider in Kratos config with the new mapper and requested scopes.
  • Extends local dev Docker Compose env wiring for Microsoft `client_id`, `client_secret`, and tenant configuration.
Technical Notes: The mapper prioritizes `email`, then `preferred_username`, then `upn` for populating `traits.emails` and verification state.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 3 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

@github-actions github-actions bot added the type/eng > frontend Owned by the @frontend team label Mar 25, 2026
@TimDiekmann TimDiekmann force-pushed the t/be-477-set-up-microsoftazure-ad-oidc-sso branch from 8e31e16 to e985544 Compare March 25, 2026 16:38
@github-actions github-actions bot removed the type/eng > frontend Owned by the @frontend team label Mar 25, 2026
@vercel vercel bot temporarily deployed to Preview – petrinaut March 25, 2026 16:50 Inactive
@TimDiekmann TimDiekmann force-pushed the t/be-477-set-up-microsoftazure-ad-oidc-sso branch from e985544 to ab68a72 Compare March 25, 2026 18:18
@vercel vercel bot temporarily deployed to Preview – petrinaut March 25, 2026 18:18 Inactive
Copy link
Copy Markdown
Member Author

TimDiekmann commented Mar 25, 2026

CiaranMn
CiaranMn previously approved these changes Mar 25, 2026
Base automatically changed from t/be-476-set-up-google-oidc-sso to main April 2, 2026 15:35
@github-actions github-actions bot added the type/eng > frontend Owned by the @frontend team label Apr 2, 2026
@github-actions github-actions bot dismissed CiaranMn’s stale review April 2, 2026 15:35

Could not find data on the previous version of this PR; see action logs at https://github.com/hashintel/hash/actions/runs/23908536429

@graphite-app graphite-app bot requested a review from a team April 2, 2026 15:36
- Add Microsoft OIDC provider config in kratos.yml with tenant env var
- Add Microsoft Jsonnet mapper (handles email/preferred_username/upn)
- Add docker-compose env vars for Microsoft client_id, secret, tenant_id
- Style flow messages based on type (red for errors, blue for info)
- Guard Microsoft Jsonnet upn claim with existence check
- Check email_verified claim in Microsoft mapper when present
- Add Microsoft env vars to .env.local setup comment
@TimDiekmann TimDiekmann force-pushed the t/be-477-set-up-microsoftazure-ad-oidc-sso branch from ab68a72 to 6dd8021 Compare April 2, 2026 15:36
@vercel vercel bot temporarily deployed to Preview – petrinaut April 2, 2026 15:36 Inactive
@github-actions github-actions bot removed the type/eng > frontend Owned by the @frontend team label Apr 2, 2026
@graphite-app
Copy link
Copy Markdown
Contributor

graphite-app bot commented Apr 2, 2026

Merge activity

  • Apr 2, 3:37 PM UTC: Graphite rebased this pull request, because this pull request is set to merge when ready.

@TimDiekmann TimDiekmann requested a review from CiaranMn April 2, 2026 15:39
@TimDiekmann TimDiekmann enabled auto-merge April 2, 2026 15:39
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

mapper_url: "file:///etc/config/kratos/hooks/oidc.microsoft.jsonnet"
scope:
- email
- profile
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing requested_claims makes email verification check ineffective

Medium Severity

The Microsoft provider in kratos.yml doesn't include requested_claims for email_verified (unlike the Google provider), so Microsoft will almost never include email_verified in the ID token. This means the email_verified check in oidc.microsoft.jsonnet is effectively dead code — the mapper will always fall into the else branch that unconditionally marks emails as verified. Combined with the preferred_username/upn fallback chain, any value Microsoft returns gets auto-verified without actual verification.

Additional Locations (1)
Fix in Cursor Fix in Web

Merged via the queue into main with commit b03f6fe Apr 2, 2026
42 checks passed
@TimDiekmann TimDiekmann deleted the t/be-477-set-up-microsoftazure-ad-oidc-sso branch April 2, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/apps > hash* Affects HASH (a `hash-*` app) area/apps

Development

Successfully merging this pull request may close these issues.

2 participants