> For the complete documentation index, see [llms.txt](https://wiki.datadike.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.datadike.com/pam/administration/identities/sso-entra-id.md). Agents can also search and read this documentation through its [MCP server](https://wiki.datadike.com/~gitbook/mcp).

# Single sign-on with Microsoft Entra ID

Let users sign in to the console with their Microsoft work account, by registering the solution in Microsoft Entra ID and connecting it over OIDC.

## What this is and when to use it

This page connects the console to Microsoft Entra ID over OpenID Connect (OIDC). Once it is done, the login screen shows an **OpenID** button, and users sign in with their Microsoft work account instead of a local password.

The work happens in two consoles at the same time: the Microsoft Entra admin center (`entra.microsoft.com`), where you register the application, and **System settings › Authentication › OIDC** here, where you paste the values Entra ID gives you. Keep both open in separate browser tabs; you will copy values from one to the other several times.

For how single sign-on behaves in general (methods, service URLs, attribute mapping), see [Single sign-on](https://wiki.datadike.com/pam/administration/identities/sso.md).

## Before you start

* The **SYSADMIN** profile. On a new installation, sign in with the administrator account DataDike handed over with it; after the first access, use your own administrator user.
* An Entra ID account allowed to register applications in the tenant.
* The public address of this installation, for example `https://pam.contoso.example`.
* A local administrator login that keeps working without SSO, so that a mistake in this configuration does not lock you out.

## Steps

### Register the application in Entra ID

1. In the Microsoft Entra admin center, open **App registrations** and click **New registration**.
2. In **Name**, type a name that identifies the application, for example `DataDike PAM`.
3. In **Supported account types**, choose **Single tenant** (accounts in this organizational directory only).
4. In **Redirect URI**, choose the **Web** platform and enter the callback URL of this installation:

   ```
   https://<your-server>/core/auth/openid/callback/
   ```

   Replace `<your-server>` with the installation's hostname. Keep the path `/core/auth/openid/callback/` exactly as written: it is the address the solution expects Entra ID to return to.
5. Click **Register**.
6. On the application's **Overview** page, copy the **Application (client) ID**.

### Create the client secret

1. In the same registration, open **Certificates & secrets** and click **New client secret**.
2. Enter a description and choose the expiry. A year or more avoids frequent renewals. When the secret expires, sign-in through Entra ID stops working until a new secret is created and entered here, so record the date.
3. Copy the **Value** column, not the **Secret ID**. The value is shown only once: if you leave the page without copying it, create another secret.

### Fill in the Basic section

1. Here, open **System settings › Authentication** and select the **OIDC** tab.
2. Turn on **OIDC**.
3. In **Base site URL**, enter the public address of this installation, for example `https://pam.contoso.example`. The callback URL is built from it.
4. In **Client Id**, paste the **Application (client) ID**.
5. In **Client Secret**, paste the secret **Value**.
6. In **Request method**, choose **Client Secret Post**.

### Fill in the Server section

1. Untick **Use Keycloak**. The endpoint fields appear.
2. In Entra ID, on the application's **Overview** page, click **Endpoints**. Copy the URL of the **OpenID Connect metadata document** and open it in a new browser tab. It lists every endpoint already carrying your tenant ID.
3. Fill in the endpoints from that document:

   | Field                  | Value                                                                                                           |
   | ---------------------- | --------------------------------------------------------------------------------------------------------------- |
   | Provider endpoint      | The issuer base, up to the tenant ID, with the trailing slash: `https://login.microsoftonline.com/<tenant-id>/` |
   | Authorization endpoint | `https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/authorize`                                           |
   | Token endpoint         | `https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/token`                                               |
   | JWKS endpoint          | `https://login.microsoftonline.com/<tenant-id>/discovery/v2.0/keys`                                             |
   | Userinfo endpoint      | Clear the field and enter `https://graph.microsoft.com/oidc/userinfo`                                           |
   | End session endpoint   | `https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/logout`                                              |
   | Signature algorithm    | The algorithm the metadata document lists under `id_token_signing_alg_values_supported`, normally `RS256`       |
   | Signing key            | Leave empty                                                                                                     |
   | Enable PKCE            | Leave unticked                                                                                                  |

   `<tenant-id>` is the **Directory (tenant) ID**, for example `00000000-0000-0000-0000-000000000000`. Copying the URLs from the metadata document, rather than typing them, guarantees it is right in every field.
4. In **Scopes**, keep the default `openid profile email`.
5. In **ID Token max age (s)**, enter `600`.
6. Leave these ticked: **ID Token include claims**, **Use state**, **Use nonce**, **Always update user**, **Ignore SSL verification**, and **Share session**.

### Fill in the Search section and save

1. In **Search**, keep the default **User attribute** map:

   ```json
   {
     "name": "name",
     "username": "preferred_username",
     "email": "email"
   }
   ```

   For OIDC, the key is the field here and the value is the claim Entra ID sends. `preferred_username` normally carries the user principal name, such as `maria@contoso.example`, which becomes the username.
2. In **Organization**, choose the organization that new users are created in. Users always belong to the Default organization as well.
3. Click **Save**.

### Optional: accept only users who already exist

By default, a Microsoft account that signs in for the first time gets a user record created automatically. To accept only accounts already registered here, created by hand or synchronized from LDAP, open **System settings › Security › Login restriction** and turn on **Existing users only**.

The setting applies to every external authentication method, not only to OIDC.

## What you should see

The login screen shows an **OpenID** button next to the local login form.

## How to verify it worked

1. Sign out, or open a private browser window, and go to the login page. The **OpenID** button must be there.
2. Click **OpenID** and authenticate with a Microsoft work account. You must be sent to Microsoft, authenticate there, and come back signed in.
3. Open **Users › Users** and find that user. The **Source** column must show OpenID rather than `Local`, and **Name** and **Email** must be filled.
4. Confirm the user landed in the organization you chose.
5. If you turned on **Existing users only**, try an account that is not registered here. It must be refused.

## Common errors

| Symptom                                                   | Cause                                                                                                | Fix                                                                                                        |
| --------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| Microsoft shows `AADSTS50011` after the account is chosen | The **Redirect URI** registered in Entra ID does not match the callback built from **Base site URL** | Make both resolve to `https://<your-server>/core/auth/openid/callback/`, with the same scheme and hostname |
| Microsoft shows `AADSTS7000215`                           | **Client Secret** holds the **Secret ID** instead of the **Value**, or a mistyped value              | Create a new secret and paste its **Value**                                                                |
| Sign-in worked for months, then stopped for everyone      | The client secret expired                                                                            | Create a new secret in **Certificates & secrets** and update **Client Secret** here                        |
| The **OpenID** button does not appear                     | **OIDC** is off, or the form was not saved                                                           | Turn on **OIDC** and click **Save**                                                                        |
| Sign-in works but the user has no name or email           | The **User attribute** map was changed, or **Scopes** no longer includes `profile email`             | Restore the default map and scopes                                                                         |
| Token validation fails on return from Microsoft           | **Signature algorithm** does not match the metadata document                                         | Set the algorithm the metadata lists, normally `RS256`                                                     |
| An account that is not registered here is refused         | **Existing users only** is on                                                                        | Expected. Register the user first, or turn the setting off                                                 |

## Field reference

Values for Entra ID on the **OIDC** tab:

| Section | Field                                                                                                     | Value for Entra ID                          |
| ------- | --------------------------------------------------------------------------------------------------------- | ------------------------------------------- |
| Basic   | OIDC                                                                                                      | On                                          |
| Basic   | Base site URL                                                                                             | Public address of this installation         |
| Basic   | Client Id                                                                                                 | **Application (client) ID**                 |
| Basic   | Client Secret                                                                                             | The secret's **Value**                      |
| Basic   | Request method                                                                                            | Client Secret Post                          |
| Server  | Use Keycloak                                                                                              | Off                                         |
| Server  | Provider, Authorization, Token, JWKS, End session endpoints                                               | From the OpenID Connect metadata document   |
| Server  | Userinfo endpoint                                                                                         | `https://graph.microsoft.com/oidc/userinfo` |
| Server  | Signature algorithm                                                                                       | As listed in the metadata, normally `RS256` |
| Server  | Signing key                                                                                               | Empty                                       |
| Server  | Enable PKCE                                                                                               | Off                                         |
| Server  | Scopes                                                                                                    | `openid profile email`                      |
| Server  | ID Token max age (s)                                                                                      | `600`                                       |
| Server  | ID Token include claims, Use state, Use nonce, Always update user, Ignore SSL verification, Share session | On                                          |
| Search  | User attribute                                                                                            | Default map                                 |
| Search  | Organization                                                                                              | The organization new users are created in   |

## Related pages

* [Single sign-on](https://wiki.datadike.com/pam/administration/identities/sso.md): methods, service URLs, and attribute mapping
* [Single sign-on with Google Workspace](https://wiki.datadike.com/pam/administration/identities/sso-google-workspace.md): the same result over SAML2
* [Users and groups](https://wiki.datadike.com/pam/administration/identities/users-and-groups.md): the records SSO creates
* [LDAP and Active Directory](https://wiki.datadike.com/pam/administration/identities/ldap-and-ad.md): registering users in advance
* [Login policies](https://wiki.datadike.com/pam/administration/access/login-policies.md): when and from where sign-in is allowed
