> ## Documentation Index
> Fetch the complete documentation index at: https://wundergraphinc-auto-improve-queries-with-defer.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Microsoft Entra

> Setting up SSO with Microsoft Entra

### Steps to set Entra as an OIDC identity provider:-

<Steps>
  <Step>
    Log in to Microsoft Entra and navigate to the **Identity/Applications/Enterprise applications** view within Microsoft Entra.

    <Frame>
      <img src="https://mintcdn.com/wundergraphinc-auto-improve-queries-with-defer/lkonUAgtUmzaMhJ9/images/studio/sso/create-new-app-in-microsoft-entra.png?fit=max&auto=format&n=lkonUAgtUmzaMhJ9&q=85&s=4d98fb35c31ff2bc86bde8c011c8bb9b" alt="Microsoft Entra admin center with Enterprise Applications and New Application button" title="Create new app in Microsoft Entra" width="2304" height="1255" data-path="images/studio/sso/create-new-app-in-microsoft-entra.png" />
    </Frame>
  </Step>

  <Step>
    Click on **New application.**
  </Step>

  <Step>
    Once navigated to a new page, click on **Create your own application**.

    <Frame>
      <img src="https://mintcdn.com/wundergraphinc-auto-improve-queries-with-defer/lkonUAgtUmzaMhJ9/images/studio/sso/create-custom-application-in-entra.png?fit=max&auto=format&n=lkonUAgtUmzaMhJ9&q=85&s=de1536712421961bca6bccdbbe26cebf" alt="Microsoft Entra admin center showing Create Your Own Application option" title="Create custom application in Entra" width="2304" height="1252" data-path="images/studio/sso/create-custom-application-in-entra.png" />
    </Frame>
  </Step>

  <Step>
    Provide a name to the application and select "**Register an application to integrate with Microsoft Entra ID (App you're developing)**" for the application purpose, then click on the **Create** button.
  </Step>

  <Step>
    Select who can use the application from the given options according to your needs and then click on **Register.**
  </Step>

  <Step>
    Now navigate to **Identity/Applications/App registrations.**
  </Step>

  <Step>
    In the **All applications tab,** select the application which we created.

    <Frame>
      <img src="https://mintcdn.com/wundergraphinc-auto-improve-queries-with-defer/lkonUAgtUmzaMhJ9/images/studio/sso/app-registrations-list-in-entra.png?fit=max&auto=format&n=lkonUAgtUmzaMhJ9&q=85&s=74bd7635d250f506bbc44121de3fb824" alt="Microsoft Entra admin center listing registered apps “test” and “test2”" title="App registrations list in Entra" width="2304" height="1253" data-path="images/studio/sso/app-registrations-list-in-entra.png" />
    </Frame>
  </Step>

  <Step>
    Copy the Application(Client) ID, then click on **Endpoints** and then copy the **OpenID Connect metadata document**(Discovery Endpoint).

    <Frame>
      <img src="https://mintcdn.com/wundergraphinc-auto-improve-queries-with-defer/lkonUAgtUmzaMhJ9/images/studio/sso/openid-connect-metadata-in-entra.png?fit=max&auto=format&n=lkonUAgtUmzaMhJ9&q=85&s=0108bc65b29256a32cc4693fe662dde2" alt="Endpoints section in Microsoft Entra highlighting OpenID Connect metadata document" title="OpenID Connect metadata in Entra" width="2304" height="1186" data-path="images/studio/sso/openid-connect-metadata-in-entra.png" />
    </Frame>
  </Step>

  <Step>
    Navigate to **Certificates and Secrets.**
  </Step>

  <Step>
    Click on  **New client secret,** give it a description and select the expiry according to your needs and then click on **Add**.
  </Step>

  <Step>
    Copy the **value(client secret)** and store it, as it won't be shown again.

    <Frame>
      <img src="https://mintcdn.com/wundergraphinc-auto-improve-queries-with-defer/lkonUAgtUmzaMhJ9/images/studio/sso/certificates-secrets-with-new-client-secret.png?fit=max&auto=format&n=lkonUAgtUmzaMhJ9&q=85&s=f834e1a82bbad04e63b265e96dbbbbbc" alt="Microsoft Entra Certificates & secrets showing new client secret created on March 14, 2024" title="Certificates & secrets with new client secret" width="2304" height="1240" data-path="images/studio/sso/certificates-secrets-with-new-client-secret.png" />
    </Frame>
  </Step>

  <Step>
    Navigate to the settings page on Cosmo.

    <Frame>
      <img src="https://mintcdn.com/wundergraphinc-auto-improve-queries-with-defer/lkonUAgtUmzaMhJ9/images/studio/sso/organization-settings-with-ai-rbac-scim.png?fit=max&auto=format&n=lkonUAgtUmzaMhJ9&q=85&s=ed8450bbe9a72545fab583f68a553118" alt="Organization settings showing name, slug, and status of AI, RBAC, and SCIM features" title="Organization settings with AI, RBAC, SCIM" width="2796" height="1902" data-path="images/studio/sso/organization-settings-with-ai-rbac-scim.png" />
    </Frame>
  </Step>

  <Step>
    Give the connection a name, paste the **OpenID Connect metadata document** copied before, into the  **Discovery Endpoint,** paste the **Client ID** and  **Client secret** copied before into the **Client ID** and  **Client Secret fields respectively,** and then click on **Connect.**

    <Frame>
      <img src="https://mintcdn.com/wundergraphinc-auto-improve-queries-with-defer/lkonUAgtUmzaMhJ9/images/studio/sso/connect-openid-provider-for-organization.png?fit=max&auto=format&n=lkonUAgtUmzaMhJ9&q=85&s=fb54c165bc705b1482557efad0efc1c0" alt="Connecting OpenID Connect provider for specific organization in Cosmo Docs" title="Connect OpenID provider for organization" width="1536" height="856" data-path="images/studio/sso/connect-openid-provider-for-organization.png" />
    </Frame>
  </Step>

  <Step>
    Configure the mapping between the roles in Cosmo and the groups in Microsoft Entra. The field **Group in the provider** should be populated with the **Object ID of a group from Entra.** Once all the mappers are configured, click on **Save**. Every member in those groups would get the respective role configured.

    <Frame>
      <img src="https://mintcdn.com/wundergraphinc-auto-improve-queries-with-defer/lkonUAgtUmzaMhJ9/images/studio/sso/configure-group-mappers-for-roles.png?fit=max&auto=format&n=lkonUAgtUmzaMhJ9&q=85&s=74ae3aa478fc76c2d50db72e5e85469a" alt="Group mapper configuration showing Cosmo role and provider group fields" title="Configure group mappers for roles" width="1536" height="841" data-path="images/studio/sso/configure-group-mappers-for-roles.png" />
    </Frame>

    <br />

    <Frame caption="Object ID of the groups in Entra">
      <img src="https://mintcdn.com/wundergraphinc-auto-improve-queries-with-defer/lkonUAgtUmzaMhJ9/images/studio/sso/groups-list-in-microsoft-entra.png?fit=max&auto=format&n=lkonUAgtUmzaMhJ9&q=85&s=b39f35b55d21dda3771e3c9786fedb13" alt="Microsoft Entra admin center showing two groups with object IDs listed" title="Groups list in Microsoft Entra" width="2304" height="1254" data-path="images/studio/sso/groups-list-in-microsoft-entra.png" />
    </Frame>
  </Step>

  <Step>
    Copy the sign-in and sign-out redirect URIs displayed in the dialog.

    <Frame>
      <img src="https://mintcdn.com/wundergraphinc-auto-improve-queries-with-defer/lkonUAgtUmzaMhJ9/images/studio/sso/oidc-provider-configuration-steps.png?fit=max&auto=format&n=lkonUAgtUmzaMhJ9&q=85&s=ef77e5070da8547933a9922bf0a5ffe7" alt="Steps to configure OIDC provider with sign-in and sign-out redirect URLs" title="OIDC provider configuration steps" width="2784" height="1848" data-path="images/studio/sso/oidc-provider-configuration-steps.png" />
    </Frame>
  </Step>

  <Step>
    Navigate back to the **App registrations** page, in the **All applications** tab select the app which we created.
  </Step>

  <Step>
    Click on **Add a redirect URI, and** now click on  **Add a platform,** select  **Web** and then paste the Sign-in and Sign-out redirect URIs in the **Redirect URIs** and  **Front-channel logout URL **respectively**.**

    <Frame>
      <img src="https://mintcdn.com/wundergraphinc-auto-improve-queries-with-defer/lkonUAgtUmzaMhJ9/images/studio/sso/add-redirect-uri-in-azure-ad-registration.png?fit=max&auto=format&n=lkonUAgtUmzaMhJ9&q=85&s=48c6f427ba1b870c6591689e6795ae2e" alt="Azure AD registration page highlighting Add Redirect URI button" title="Add Redirect URI in Azure AD registration" width="2304" height="1258" data-path="images/studio/sso/add-redirect-uri-in-azure-ad-registration.png" />
    </Frame>
  </Step>

  <Step>
    Select  **ID tokens** and then click on **Configure.**
  </Step>

  <Step>
    Now navigate to **Token configuration**, and click on **Add groups claim.**
  </Step>

  <Step>
    Select  **Security groups,** expand  **ID,** select  **Group ID** and click on **Add.**

    <Frame>
      <img src="https://mintcdn.com/wundergraphinc-auto-improve-queries-with-defer/lkonUAgtUmzaMhJ9/images/studio/sso/token-configuration-with-group-claims.png?fit=max&auto=format&n=lkonUAgtUmzaMhJ9&q=85&s=89f9662423e154b5b136d828e5060699" alt="Microsoft Entra Token configuration showing Security groups claim with Group ID option" title="Token configuration with group claims" width="2304" height="1188" data-path="images/studio/sso/token-configuration-with-group-claims.png" />
    </Frame>
  </Step>

  <Step>
    Navigate to **API Permissions**, and click on **Add a permission.**

    <Frame>
      <img src="https://mintcdn.com/wundergraphinc-auto-improve-queries-with-defer/lkonUAgtUmzaMhJ9/images/studio/sso/add-microsoft-graph-api-permissions.png?fit=max&auto=format&n=lkonUAgtUmzaMhJ9&q=85&s=5d09b380ccf0abe5ab58fb38bb518f28" alt="Microsoft Entra API permissions section for adding Microsoft Graph API access" title="Add Microsoft Graph API permissions" width="2304" height="1187" data-path="images/studio/sso/add-microsoft-graph-api-permissions.png" />
    </Frame>
  </Step>

  <Step>
    Click on **Microsoft Graph,** and then on  **Delegated permissions,** select  **email, openid and profile** and then click on **Add permissions.**
  </Step>

  <Step>
    Now you can assign users/groups to the application, and only those users will be able to log into Cosmo using the URL provided on setting up the provider.

    <Frame>
      <img src="https://mintcdn.com/wundergraphinc-auto-improve-queries-with-defer/lkonUAgtUmzaMhJ9/images/studio/sso/add-user-or-group-in-entra.png?fit=max&auto=format&n=lkonUAgtUmzaMhJ9&q=85&s=e55a76a352aeeb9d14bfa1f1fc07563e" alt="Microsoft Entra Users and groups section showing Add user/group button" title="Add user or group in Entra" width="2304" height="1254" data-path="images/studio/sso/add-user-or-group-in-entra.png" />
    </Frame>
  </Step>
</Steps>

<Info>
  Please make sure that the users added to the application have an email.

  Steps to add a user:

  <Steps>
    <Step>
      Navigate to Users/All users, click on New User and then click on Create a new user.

      <Frame>
        <img src="https://mintcdn.com/wundergraphinc-auto-improve-queries-with-defer/lkonUAgtUmzaMhJ9/images/studio/sso/create-new-user-in-entra.png?fit=max&auto=format&n=lkonUAgtUmzaMhJ9&q=85&s=8ac5f29b502453b8123c75475e3242b3" alt="Microsoft Entra Users section highlighting Create new user option" title="Create new user in Entra" width="2304" height="1254" data-path="images/studio/sso/create-new-user-in-entra.png" />
      </Frame>
    </Step>

    <Step>
      Provide the user principal name, the display name and then click on **Next**.

      <Frame>
        <img src="https://mintcdn.com/wundergraphinc-auto-improve-queries-with-defer/lkonUAgtUmzaMhJ9/images/studio/sso/create-new-user-form-in-entra.png?fit=max&auto=format&n=lkonUAgtUmzaMhJ9&q=85&s=2aa0aaab6a706ecbcdf85aa9e248eccb" alt="Create new user dialog in Microsoft Entra with principal name and display fields" title="Create new user form in Entra" width="2304" height="1251" data-path="images/studio/sso/create-new-user-form-in-entra.png" />
      </Frame>
    </Step>

    <Step>
      Provide the first name(optional) and the last name(optional).
    </Step>

    <Step>
      Provide the email of the user(**Required**).

      <Frame>
        <img src="https://mintcdn.com/wundergraphinc-auto-improve-queries-with-defer/lkonUAgtUmzaMhJ9/images/studio/sso/new-user-creation-form-in-entra.png?fit=max&auto=format&n=lkonUAgtUmzaMhJ9&q=85&s=2afdf6f64a5f6db9e96c770dd9c31d7c" alt="Microsoft Entra Identity section for new user creation with name and email fields" title="New user creation form in Entra" width="2304" height="1185" data-path="images/studio/sso/new-user-creation-form-in-entra.png" />
      </Frame>
    </Step>

    <Step>
      Then click on **Next** and assign the user to the groups according to your needs.
    </Step>
  </Steps>
</Info>
