CrushOIDC with Microsoft Entra#
This sets up "Sign in with Microsoft" on the login page, with CrushOIDC and Microsoft Entra ID, the directory behind Microsoft 365 that used to be called Azure AD.
1. Register the server in Entra#
In the Microsoft Entra admin center: App registrations › New registration.
| Field | Give |
|---|---|
| Name | a name people will recognise on the consent page |
| Supported account types | usually: accounts in this organisational directory only |
| Redirect URI | platform Web, and the address of the server ending in /SSO_OIDC/: https://files.example.com/SSO_OIDC/ |
After Register:
- From Overview, note the Application (client) ID and the Directory (tenant) ID.
- Certificates & secrets › New client secret. Copy the Value at once: it is shown only now. Note when it ends; the sign-in stops working that day.
- API permissions: the delegated permission User.Read of Microsoft Graph is enough to sign people in. Grant admin consent.
2. Set the plugin#
| Setting | Value |
|---|---|
| OpenID Configuration URL | https://login.microsoftonline.com/ + the tenant ID + /v2.0/.well-known/openid-configuration. Then Fetch Configuration. |
| Client ID | the application ID |
| Client Secret | the secret's value |
| Scope | openid profile email |
| Claim as Username | email, or preferred_username for the sign-in name |
| PKCE?, Verify ID Token? | on |
| Login button text | "Sign in with Microsoft" |
and the settings for what the user gets.
3. Groups#
To let in only some people, or to give groups different folders, the server must learn the groups. There are two ways.
Groups in the token#
In the app registration: Token configuration › Add groups claim. Choose which groups, and in which form they are named: the group's ID, which is the usual, or its name.
The claim is called groups. In the plugin's OAuth Roles:
groups=0788f1c2-1111-2222-3333-444455556666 : oidc_staff
with the ID of the group, or its name if you chose names.
Microsoft leaves the claim out for a person who is in more than 200 groups. For them, use the second way.
Asking Microsoft Graph#
The plugin asks Microsoft for the person's groups after the sign-in.
- In the app registration, API permissions › Add a permission › Microsoft Graph › Delegated permissions: GroupMember.Read.All. An administrator must Grant admin consent.
- In the plugin: tick Check User Endpoint URL? and set User Endpoint URL to
https://graph.microsoft.com/v1.0/me. - The server must be able to reach
graph.microsoft.com.
The plugin then has two more names to use in roles:
| Name | Holds |
|---|---|
microsoft_groups |
the names of the person's groups |
microsoft_group_ids |
their IDs |
microsoft_groups=FileTransfer : oidc_staff
microsoft_groups=*Partners* : oidc_partners
4. Signing out of Microsoft too#
End Session URL:
{end_session_endpoint}?id_token_hint={id_token}&post_logout_redirect_uri=https%3A%2F%2Ffiles.example.com%2F
Register https://files.example.com/ in the app registration under Authentication as a front-channel logout or redirect address, and set the customization on the template user: see signing out.
Things to know#
- Who may sign in is also set in Entra. Under Enterprise applications, the application can demand that people are assigned to it. Then Entra itself refuses everybody else, before the server is asked.
- Guests of your directory arrive with an email address of another organisation. If you match by
*@example.com, they are not let in. - The secret ends. Put its end date into a calendar. The expiry calendar of the server does not know about secrets at providers.
- Azure AD B2C uses another configuration address, of the form
https://TENANT.b2clogin.com/TENANT.onmicrosoft.com/POLICY/v2.0/.well-known/openid-configuration. Microsoft no longer lets new B2C tenants be made; existing ones work. - To reach each person's OneDrive or SharePoint with their own rights: a VFS from the sign-in.
- SAML in place of OpenID Connect works with Entra as well: SAMLSSO with Microsoft Entra. Use one of the two.
Not tried for this page#
Nothing was run against Microsoft Entra: no account there was used. The steps on the provider's side follow the earlier documentation and the provider's console as it is known; names of menus change over time. The plugin's side is from its screen. Try the first setup with one test user, with Debug and Log HTTP Request Calls on.