# Microsoft Entra ID

> Connect a SAML enterprise application in Microsoft Entra ID, formerly Azure AD.

Source: https://diakrin.com/docs/sso/microsoft-entra

An Entra administrator connects Microsoft Entra ID (formerly Azure Active Directory) to Diakrin with a SAML enterprise application. You need application-management permissions in your tenant and the [setup packet](/docs/sso#get-your-setup-packet).

## Create the application

1. In Microsoft Entra admin center, open **Enterprise applications → New application → Create your own application**.
2. Name it **Diakrin** and choose to integrate an application you do not find in the gallery.
3. Open **Single sign-on → SAML** and edit **Basic SAML Configuration** with the values below.
4. In **Attributes & Claims**, edit **Unique User Identifier (Name ID)**: format **Persistent**, source attribute `user.objectid`. Add a claim named `email` from `user.mail`.
5. Assign pilot users or groups under **Users and groups** and apply your company's Conditional Access policy.

## Map the fields

| Entra field | Value |
| --- | --- |
| Identifier (Entity ID) | `urn:amazon:cognito:sp:<poolId>` from the setup packet |
| Reply URL (Assertion Consumer Service URL) | `https://auth.diakrin.com/saml2/idpresponse` |
| Sign on URL | `https://app.diakrin.com` |
| Unique User Identifier (Name ID) format | Persistent |
| Unique User Identifier (Name ID) source | `user.objectid`, never the UPN or email |
| Additional claim `email` | `user.mail`, the work email |

The object id never changes and is never reused, so a new employee who later gets the same address cannot sign in as the former one.

To use OIDC instead, register a web app with the redirect URI `https://auth.diakrin.com/oauth2/idpresponse` and the issuer `https://login.microsoftonline.com/<tenant-id>/v2.0`; see [Connect with OIDC](/docs/sso#connect-with-oidc).

## Activate and test

From **SAML Certificates**, copy **App Federation Metadata Url**. In **Settings → Sign-in → SSO identity provider**, paste the metadata URL or upload the XML, then select **Verify and connect**. After activation, follow [Test and roll out SSO](/docs/sso/testing).

## If it fails

| Symptom | Cause | Fix |
| --- | --- | --- |
| AADSTS50011 reply URL mismatch | The Reply URL differs | Use `https://auth.diakrin.com/saml2/idpresponse` exactly |
| An assigned user is blocked | Conditional Access | Review the application's sign-in logs; do not relax tenant-wide policy for one application |
| Entra succeeds but Diakrin refuses | The person is not a member of your organization yet | See [Sign in and join your team](/docs/sso#sign-in-and-join-your-team) |

Official reference: [Enable SAML single sign-on for an enterprise application](https://learn.microsoft.com/en-us/entra/identity/enterprise-apps/add-application-portal-setup-sso).
