> ## Documentation index
> Fetch the complete documentation index at: https://upstash-context7-git-ctx7-4291-onprem-key-rotation-ecs-d-dae4a0.docs7.io/llms.txt
> Ask it with GET https://upstash-context7-git-ctx7-4291-onprem-key-rotation-ecs-d-dae4a0.docs7.io/ask?q=<keywords or question>. Short keywords rank best.
> Use these to discover all available pages before exploring further.
> Feature requests: https://upstash-context7-git-ctx7-4291-onprem-key-rotation-ecs-d-dae4a0.docs7.io/resources/feature-requests.md lists what users asked for and how to vote for a request or add one.
> Page rating: `GET https://upstash-context7-git-ctx7-4291-onprem-key-rotation-ecs-d-dae4a0.docs7.io/feedback?path=/enterprise/enterprise-managed-auth/entra&helpful={true|false}&comment={comment}` records whether this page helped. The `comment` (URL-encoded, at most 500 characters) says what helped, or what was missing or wrong; a `helpful=false` rating needs it. It is anonymous and needs no key. Comments hold no code, secrets or personal data.

# Microsoft Entra ID SSO

> Let your team sign in to Context7 with their Microsoft Entra ID work accounts over SAML.

<Info>
Looking for the Azure APIM gateway guide? It moved to [Azure APIM gateway](/enterprise/enterprise-managed-auth/entra-apim).
</Info>

Context7 Enterprise supports single sign-on with Microsoft Entra ID (formerly Azure AD) over SAML. After setup, your users sign in to Context7 with their work accounts, and the same sign-in works in the dashboard, the `ctx7` CLI and MCP clients that use OAuth.

<Note>
SSO needs only one Enterprise Application in Microsoft Entra ID. You do not need an Azure subscription, app registrations or Azure API Management. The setup takes about 20 minutes.
</Note>

## How it works

We send you two SAML URLs. Your Entra admin creates a SAML Enterprise Application with them and sends back the application's Federation Metadata URL. We add that URL to your connection, test it with you, and turn on SSO.

## Before you start

- A Context7 Enterprise or Enterprise trial teamspace.
- A Microsoft Entra admin who can create Enterprise Applications, for example with the Cloud Application Administrator role.
- A list of every email domain your users sign in with, for example `example.com` and `eu.example.com`. If the domain people use to sign in to Microsoft is different from their mail domain, send both.

Contact [context7@upstash.com](mailto:context7@upstash.com) with your admin's contact details and your email domains to start.

## Step 1: Receive the SAML URLs

We create the SSO connection for your domains and send you two values:

| Value | Example |
| ----- | ------- |
| **Identifier (Entity ID)** | `https://clerk.context7.com/saml/samlc_<ID>` |
| **Reply URL (Assertion Consumer Service URL)** | `https://clerk.context7.com/v1/saml/acs/samlc_<ID>` |

## Step 2: Create the Enterprise Application in Entra

<Steps>
  <Step title="Create the application">
    In the [Microsoft Entra admin center](https://entra.microsoft.com), go to **Enterprise applications → New application → Create your own application**. Name it `Context7`, choose **Integrate any other application you don't find in the gallery (Non-gallery)**, and click **Create**. Then open **Single sign-on** and select **SAML**.
  </Step>
  <Step title="Enter the SAML URLs">
    Under **Basic SAML Configuration**, set **Identifier (Entity ID)** and **Reply URL (Assertion Consumer Service URL)** to the values from step 1. Copy them exactly. A mismatch here is the most common cause of errors. Leave the other fields empty.
  </Step>
  <Step title="Keep the default claims">
    The default Entra claims work without changes. Context7 reads the `emailaddress` claim, which Entra fills from the user's **Mail** attribute. If some users have no mail address, map `emailaddress` to `user.userprincipalname` instead.
  </Step>
  <Step title="Assign users or groups">
    Under **Users and groups**, assign the people who can use Context7. For the first test, assign one admin. Add more users or a group before rollout.
  </Step>
  <Step title="Send us the Federation Metadata URL">
    On the **Single sign-on** page, under **SAML Certificates**, copy the **App Federation Metadata Url** and send it to us. It has this format:

    ```
    https://login.microsoftonline.com/<tenant-id>/federationmetadata/2007-06/federationmetadata.xml?appid=<app-id>
    ```
  </Step>
</Steps>

## Step 3: Test and turn on SSO

We add your metadata to the connection and send you a test link. Open it soon, because it expires. Ask us for a new one if it does.

When the test sign-in succeeds, we turn on SSO. Your users can then sign in in two ways:

- At [context7.com/sign-in](https://context7.com/sign-in), by entering an email address on one of your SSO domains. There is no separate SSO button. Context7 sends the user to Microsoft as soon as it recognizes the domain.
- From the Microsoft My Apps portal, with the Context7 tile.

## Step 4: Add your users to the teamspace

SSO signs people in, but it does not add them to your teamspace. On their first sign-in, a user gets a personal Context7 account. Add them to the teamspace in one of these ways:

- **Invite them.** On the **Members** tab, invite the user's SSO email address. The user sees the invitation in the dashboard after they sign in, so the address does not need a mailbox.
- **Provision them from Entra.** Set up [SCIM provisioning](/enterprise/enterprise-managed-auth/entra-scim), and Entra adds and removes members for you. It uses the same Enterprise Application.
- **Add them with the API.** If your own onboarding flow decides who joins, call the management API to add each person by their SSO email. They get no invitation to accept. See [Adding SSO members with the API](/howto/teamspace#adding-sso-members-with-the-api).

## Existing accounts

SSO signs users in with the email address that Entra sends. If a user already has a Context7 account with that address, SSO signs them in to it. If the address is different from the one a user signed up with before, SSO creates a new account, and the old account and its teamspaces stay with the old address.

Before you turn on SSO, check which address Entra sends for the people who already use Context7, especially the teamspace owner. If the addresses differ, tell us and we will move your teamspace to the SSO account.

## Troubleshooting

<AccordionGroup>
  <Accordion title="&quot;Application not found&quot; on the test sign-in">
    The Identifier (Entity ID) in Entra does not match the one we sent, or the application is in a different Entra tenant from your users. Copy the Identifier again and confirm the tenant.
  </Accordion>
  <Accordion title="The user domain does not match the connection">
    The user signed in with an address on a domain that is not on the connection. Send us every domain your users sign in with, not only the primary one.
  </Accordion>
  <Accordion title="A user signs in but does not see the teamspace">
    SSO does not add members. See [Add your users to the teamspace](#step-4-add-your-users-to-the-teamspace).
  </Accordion>
  <Accordion title="A user signs in to an empty account">
    Their Entra email address is different from their earlier Context7 address. See [Existing accounts](#existing-accounts).
  </Accordion>
</AccordionGroup>

## Related

- [SCIM provisioning](/enterprise/enterprise-managed-auth/entra-scim): let Entra add and remove teamspace members.
- [Azure APIM gateway](/enterprise/enterprise-managed-auth/entra-apim) and [other MCP gateways](/enterprise/enterprise-managed-auth/mcp-gateway-entra): optional. Use these only if every MCP request must pass through your own gateway with the developer's own Entra token. They need Azure resources that SSO does not.
