SSO Runbook — Microsoft Entra ID (Azure AD)¶
End-to-end setup for sign-in with Microsoft. ~10 minutes from a fresh Entra tenant to a working "Sign in with Microsoft" button on the MFCloud console.
What you'll end up with¶
- An MFCloud-specific app registration in your Entra tenant.
- A redirect URI registered for the OIDC callback.
- A front-channel logout URL registered so RP-initiated logout actually signs the user out at Microsoft.
- A client ID + client secret you'll paste into MFCloud's Settings → SSO.
- (Optional) Groups claim configured so group → role mapping works.
Prerequisites¶
- Global Administrator or Application Administrator role on the Entra tenant.
- MFCloud master reachable at a stable URL with a valid TLS cert (Entra refuses HTTP and refuses self-signed certs for sign-in URLs that aren't
localhost). - The exact MFCloud hostname — used three times below, byte-for-byte identical.
Step 1 — Create the app registration¶
- Azure Portal → Microsoft Entra ID → App registrations → + New registration.
- Fill in:
- Name —
MFCloud Console(visible only to admins). - Supported account types — most setups: Accounts in this organizational directory only (Single tenant). Pick Multitenant only if you serve external partners with their own Entra tenants.
- Redirect URI — Platform = Web, value =
https://<your-mfcloud-host>/api/auth/oidc/callback. - Register.
You land on the app's Overview page. Copy two values:
| Field | Where it goes in MFCloud |
|---|---|
| Application (client) ID | Settings → SSO → Client ID |
| Directory (tenant) ID | used to build the Issuer URL below |
The Issuer URL for MFCloud is:
(Note the /v2.0 suffix — MFCloud's OIDC verifier expects v2 tokens.)
Step 2 — Create the client secret¶
- Certificates & secrets → Client secrets → + New client secret.
- Description =
mfcloud, Expires = 24 months (set a calendar reminder to rotate). - Add.
- Copy the Value column immediately — Azure hides it after you leave the page. You can't recover it; you'd have to make a new secret.
Paste this value into Settings → SSO → Client Secret on the MFCloud side.
Don't copy Secret ID by mistake
The portal shows two columns: Value and Secret ID. The one you want is Value — typically ~40 chars, starts with a letter. Secret ID is a GUID, only useful for audit.
Step 3 — Configure the front-channel logout URL¶
Required for RP-initiated logout to bounce the user back to MFCloud cleanly.
- Authentication → Front-channel logout URL =
https://<your-mfcloud-host>/ - Save.
Without this, clicking Logout in MFCloud will sign the user out at Entra but Microsoft's logout page won't return them to MFCloud — they'll land on a generic "Pick an account to sign out of" screen.
Step 4 — Configure API permissions¶
The defaults are usually enough but worth confirming:
- API permissions → verify these Microsoft Graph delegated permissions are present:
openid(Sign users in)profile(View basic profile)email(View email address)- If they're missing → + Add a permission → Microsoft Graph → Delegated permissions → tick all three → Add.
- Grant admin consent for
— green tick should appear in the Status column.
Step 5 — Add the groups claim (optional, for group → role mapping)¶
Only needed if you want Entra group membership to drive MFCloud roles.
- Token configuration → + Add groups claim.
- Pick Security groups (or Groups assigned to the application if you're scoping tighter).
- Customize Token properties: pick Group ID for the ID token (MFCloud expects ObjectIds in the claim by default; switch to sAMAccountName only if your group map uses display names).
- Add.
To find a group's ObjectId for the MFCloud mapping table: Entra ID → Groups → click the group → Object ID field at the top.
Step 6 — Paste into MFCloud¶
In the MFCloud console:
- Settings → 🔑 Single Sign-On (OpenID Connect).
- Fill in:
- Issuer URL —
https://login.microsoftonline.com/<TENANT_ID>/v2.0 - Client ID — Application (client) ID from Step 1.
- Client Secret — Value from Step 2.
- Sign-in Button Label —
Sign in with Microsoft(default is already this). - Default Role — what newly-signed-in users get if no group mapping matches.
Tenant Vieweris the safe default. - Email Claim —
emailworks for most setups; if your tenant doesn't populateemail, change topreferred_username(Entra always has this). - Groups Claim —
groups(leave as default; Entra writes ObjectIds here once Step 5 is done). - Enable OIDC sign-in ✓.
- Save SSO Settings.
Step 7 — Test it¶
- Log out of the MFCloud console (sign out via the user avatar menu).
- The login page should now show a Sign in with Microsoft button below the local form.
- Click it. You'll be redirected to
login.microsoftonline.com. Sign in with a tenant user. - Microsoft bounces you back to
/api/auth/oidc/callback, MFCloud verifies the ID token, creates a federated user row, and lands you on the dashboard. - Open the user-avatar menu in the top right — your username should be the email (or UPN) Entra sent.
- Sign out — you should be redirected through Microsoft's logout flow and back to MFCloud's login page.
Troubleshooting¶
| Symptom | Cause | Fix |
|---|---|---|
AADSTS50011: redirect URI mismatch |
Step 1 Redirect URI doesn't byte-match what MFCloud generates | Check master is behind a reverse proxy that sends X-Forwarded-Proto: https. Uvicorn must be started with --proxy-headers. |
IdP returned error 'invalid_client' |
Client Secret wrong / expired | Step 2 — generate a fresh secret, re-paste. |
ID token rejected: aud is required |
Token's audience claim doesn't include your client_id | Token configuration → Optional claims → add aud to the ID token. |
| User signs in but lands as Tenant Viewer | Group mapping not picking up | Step 5 — confirm groups claim is enabled; check Entra ObjectId matches what you pasted in MFCloud's mapping table. |
| Logout doesn't return to MFCloud | Front-channel logout URL not registered | Step 3. |
See the SSO callback 400 troubleshooting page for deeper diagnosis.