> ## Documentation Index
> Fetch the complete documentation index at: https://closedloop.sh/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Microsoft Entra ID

> Connect Microsoft Entra ID to ClosedLoop AI with SAML SSO, SCIM user and group provisioning, role mapping, recovery, and rollout testing.

Connect Microsoft Entra ID to ClosedLoop AI so workspace members sign in through Microsoft and admins can manage user lifecycle from Entra.

> [!TIP]
>
> Start in **ClosedLoop AI > Integrations > Microsoft Entra ID**. The setup page generates the correct region URLs and workspace ID for you.

## Shortest Path

Most teams can configure Microsoft Entra ID with this flow:

| Step | Where | What to do |
| - | - | - |
| 1 | ClosedLoop AI | Open **Integrations > Microsoft Entra ID** and click **Copy setup sheet**. |
| 2 | Microsoft Entra ID | Create a private Enterprise Application named **ClosedLoop AI**. |
| 3 | Microsoft Entra ID | Configure SAML with the Identifier, Reply URL, and Sign on URL from ClosedLoop AI. |
| 4 | ClosedLoop AI | Paste the Microsoft Entra Identifier, Login URL, and signing certificate, then save. |
| 5 | Microsoft Entra ID | Configure provisioning with the SCIM Tenant URL and Secret Token from ClosedLoop AI. |
| 6 | Microsoft Entra ID | Assign users and groups, then run **Provision on demand** for one test user. |

## Send This to IT

If a separate identity admin owns Microsoft Entra ID, send them the setup sheet from ClosedLoop AI. It includes:

* SAML Identifier, Reply URL, and Sign on URL.
* Required SAML attribute claim names.
* SCIM Tenant URL.
* Secret Token after you save the ClosedLoop AI setup.
* OAuth fallback fields only if the Entra provisioning screen asks for client credentials.

They should send back the Microsoft Entra Identifier, Login URL, and SAML signing certificate. Paste those values into ClosedLoop AI and save.

## Recovery Path

Keep one ClosedLoop AI workspace owner signed in until SSO and provisioning tests pass. If a configuration change blocks sign-in, a signed-in workspace owner can return to **Integrations > Microsoft Entra ID**, turn off **Enable Microsoft Entra ID sign-in**, and save.

If every workspace owner is locked out, contact `support@closedloop.sh` with your workspace ID and region. ClosedLoop AI support can help disable the broken SSO requirement for the workspace.

## Prerequisites

* A Microsoft Entra ID admin account with permission to create Enterprise Applications.
* A ClosedLoop AI workspace admin account on the Enterprise plan.
* Your ClosedLoop AI workspace ID. ClosedLoop AI shows this value during setup.
* The correct ClosedLoop AI region for your workspace.

## Region URLs

| Region | Login URL | API URL |
| - | - | - |
| US | `https://app.closedloop.sh/auth` | `https://api.closedloop.sh` |
| EU | `https://eu.app.closedloop.sh/auth` | `https://eu.api.closedloop.sh` |

## What Microsoft Entra ID Manages

| Capability | Description |
| - | - |
| SAML SSO | Members sign in to ClosedLoop AI through Microsoft Entra ID. |
| Just-in-time provisioning | ClosedLoop AI can create a Member account after Microsoft Entra ID verifies the user. |
| Invitations | An invited person signs in through Microsoft Entra ID and joins with the role from their invitation, without a ClosedLoop AI password. |
| SCIM 2.0 provisioning | Microsoft Entra ID can create, update, and deactivate users in a ClosedLoop AI workspace. |
| Group provisioning | Microsoft Entra ID can create groups and update group membership through SCIM. Provisioned groups are listed read-only under **Settings → Members → Directory groups**; they grant no access and set no role. |

## Setup Guide

> [accordion] Step 1: Open Microsoft Entra ID setup in ClosedLoop AI
>
> 1. Sign in to ClosedLoop AI as a workspace admin.
> 2. Go to **Integrations** > **Microsoft Entra ID**.
> 3. Click **Copy setup sheet** if an identity admin will configure Entra for you.
> 4. Keep this page open. You will copy generated SAML and SCIM values into Microsoft Entra ID.

> [accordion] Step 2: Create a non-gallery Enterprise Application
>
> 1. In Microsoft Entra admin center, go to **Identity** > **Applications** > **Enterprise applications**.
> 2. Click **New application**.
> 3. Click **Create your own application**.
> 4. Set the name to **ClosedLoop AI**.
> 5. Choose **Integrate any other application you don't find in the gallery**.
> 6. Create the application.

> [accordion] Step 3: Configure SAML single sign-on
>
> In the Enterprise Application, go to **Single sign-on** and choose **SAML**.
>
> | Microsoft Entra ID field | Value |
> | - | - |
> | Identifier (Entity ID) | The **Identifier** from ClosedLoop AI |
> | Reply URL (Assertion Consumer Service URL) | The **Reply URL** from ClosedLoop AI |
> | Sign on URL | The **Sign on URL** from ClosedLoop AI |
> | Relay State | Leave blank |
> | Logout URL | Leave blank |
>
> ClosedLoop AI starts sign-in from the email screen and then redirects the user to Microsoft Entra ID.

> [accordion] Step 4: Configure SAML attributes
>
> Use these SAML claims.
>
> | Claim | Source attribute |
> | - | - |
> | `http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress` | `user.mail` or `user.userprincipalname` |
> | `http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname` | `user.givenname` |
> | `http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname` | `user.surname` |
>
> Download or copy the SAML signing certificate, then copy the Microsoft Entra **Identifier** and **Login URL**.

> [accordion] Step 5: Save Microsoft Entra ID values in ClosedLoop AI
>
> 1. Return to **Integrations** > **Microsoft Entra ID** in ClosedLoop AI.
> 2. Paste the Microsoft Entra **Identifier**.
> 3. Paste the Microsoft Entra **Login URL**.
> 4. Paste the Microsoft Entra signing certificate.
> 5. Keep **Enable Microsoft Entra ID sign-in** on.
> 6. Keep **JIT provisioning** on if members should be created on first Microsoft Entra ID sign-in.
> 7. Click **Save Microsoft Entra ID setup**.
>
> ClosedLoop AI generates a SCIM **Secret Token** after saving. Copy it immediately into Microsoft Entra ID provisioning.

> [accordion] Step 6: Configure SCIM provisioning
>
> In Microsoft Entra ID, open the ClosedLoop AI Enterprise Application and go to **Provisioning**.
>
> Use the standard Secret Token setup:
>
> | Microsoft Entra ID field | Value |
> | - | - |
> | Provisioning Mode | `Automatic` |
> | Tenant URL | The **SCIM Tenant URL** from ClosedLoop AI |
> | Secret Token | The generated ClosedLoop AI **Secret Token** |
>
> If your Microsoft Entra ID screen shows OAuth client credential fields instead of a Secret Token field, use the advanced fields from ClosedLoop AI:
>
> | Microsoft Entra ID field | Value |
> | - | - |
> | Token endpoint | The **SCIM OAuth token endpoint** from ClosedLoop AI |
> | Client ID | The generated ClosedLoop AI **Client ID** |
> | Client secret | The generated ClosedLoop AI **Client secret** |
> | Scope | `scim.read scim.write` |
>
> Test the connection, then save the provisioning configuration.

> [accordion] Step 7: Assign users and groups
>
> Assign the users and groups who should access ClosedLoop AI to the Enterprise Application.
>
> Microsoft Entra ID provisions assigned users and groups into ClosedLoop AI. Users removed from the application are deactivated in the workspace.
>
> If Entra sends no role value for an existing user, ClosedLoop AI preserves that user's current workspace role.

## Recommended Attribute Mapping

Use the default Microsoft Entra ID mappings unless your directory stores email somewhere else. Many Microsoft tenants use `userPrincipalName` as the login name, but that value is not always the user's mailbox address.

| ClosedLoop AI SCIM attribute | Recommended Microsoft Entra ID source |
| - | - |
| `userName` | `user.userprincipalname` |
| `emails[type eq "work"].value` | `user.mail` if populated, otherwise `user.userprincipalname` |
| `name.givenName` | `user.givenname` |
| `name.familyName` | `user.surname` |
| `displayName` | `user.displayname` |
| `externalId` | Microsoft Entra object ID, if available |

ClosedLoop AI recognizes a user by either their SCIM `userName` or their work email. If `userName` is a UPN such as `person@tenant.onmicrosoft.com` and work email is `person@company.com`, the user is still recognized during SAML sign-in.

## Role Mapping

ClosedLoop AI supports two provisioned workspace roles:

| SCIM role value | ClosedLoop AI role |
| - | - |
| `member` | Member |
| `admin` | Workspace admin |

If Microsoft Entra ID omits `roles`, ClosedLoop AI keeps the user's existing workspace role. New users are created as Member by default. Use role mapping only if Entra should actively manage ClosedLoop AI workspace admin/member assignments.

## Supported SCIM Features

| Feature | Supported |
| - | - |
| Create users | Yes |
| Read users | Yes |
| Update users | Yes |
| Deactivate users | Yes |
| Group create/read/update/delete | Yes |
| Group membership PATCH | Yes |
| Groups nested inside other groups | No |
| Change password | No |
| SCIM `/Bulk` | No |

## Testing

After configuration:

1. Assign one test user to the ClosedLoop AI Enterprise Application in Microsoft Entra ID.
2. Run **Provision on demand** for that user or wait for the provisioning cycle.
3. Open the ClosedLoop AI login URL for your region.
4. Enter the test user's email address.
5. Confirm ClosedLoop AI redirects the user to Microsoft Entra ID.
6. Complete sign-in and confirm the user returns to ClosedLoop AI.
7. Remove the user assignment and confirm the user is deactivated in ClosedLoop AI if lifecycle deactivation is part of your rollout.

## Troubleshooting

| Symptom | Fix |
| - | - |
| Test connection fails | Confirm the SCIM Tenant URL includes your ClosedLoop AI workspace ID and that the Secret Token was copied correctly after generation. |
| The user is not allowed into ClosedLoop AI | Confirm the user is assigned to the Enterprise Application, and JIT provisioning is enabled, the user has an open invitation to the workspace, or the user already exists in the workspace. |
| ClosedLoop AI cannot match the user's email | Confirm the SAML email claim is populated, and that SCIM sends both `userName` and work email when UPN differs from mailbox email. |
| Group membership does not appear | Confirm the user is assigned to the application and is a **direct** member of the pushed group in Microsoft Entra ID. Membership that comes only from a group nested inside the pushed group is not applied, so add the person or the inner group to the application directly. |
| Users sign in but are not provisioned | Confirm Microsoft Entra ID provisioning is set to `Automatic` and that the user is assigned to the Enterprise Application. |
| SAML works but provisioning does not | Re-copy the SCIM Tenant URL and Secret Token from ClosedLoop AI. Use OAuth fields only if the Entra provisioning screen explicitly asks for them. |
| An admin became a member | Confirm Entra is not sending a `member` role entitlement for that user. If no role is sent, ClosedLoop AI preserves the existing role. |
| Workspace owners are locked out | Contact `support@closedloop.sh` with the workspace ID and region. |

## Microsoft References

* [Create and manage Enterprise Applications](https://learn.microsoft.com/en-us/entra/fundamentals/entra-admin-center)
* [Provision users and groups with SCIM](https://learn.microsoft.com/en-us/entra/identity/app-provisioning/use-scim-to-provision-users-and-groups)
* [Provision on demand](https://learn.microsoft.com/en-us/entra/identity/app-provisioning/provision-on-demand)

## Support

For help configuring Microsoft Entra ID with ClosedLoop AI, contact `support@closedloop.sh`.

> [card] [Open ClosedLoop AI US](https://app.closedloop.sh/integrations/microsoft-entra-id)
>
> Configure Microsoft Entra ID in a US workspace

> [card] [Open ClosedLoop AI EU](https://eu.app.closedloop.sh/integrations/microsoft-entra-id)
>
> Configure Microsoft Entra ID in an EU workspace


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.