> ## Documentation Index
> Fetch the complete documentation index at: https://wundergraphinc-brendan-add-sof-link.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-brendan-add-sof-link/4e0tdWXXIKi1QWpK/images/studio/sso/create-new-app-in-microsoft-entra.png?fit=max&auto=format&n=4e0tdWXXIKi1QWpK&q=85&s=03eba92014e882bd58b61534b7a4be89" 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-brendan-add-sof-link/4e0tdWXXIKi1QWpK/images/studio/sso/create-custom-application-in-entra.png?fit=max&auto=format&n=4e0tdWXXIKi1QWpK&q=85&s=2273a701ffbcfd43dcf6d047cc9bdb3e" 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-brendan-add-sof-link/4e0tdWXXIKi1QWpK/images/studio/sso/app-registrations-list-in-entra.png?fit=max&auto=format&n=4e0tdWXXIKi1QWpK&q=85&s=61c38aea0dfabc68c6a47f3091d339c4" 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-brendan-add-sof-link/4e0tdWXXIKi1QWpK/images/studio/sso/openid-connect-metadata-in-entra.png?fit=max&auto=format&n=4e0tdWXXIKi1QWpK&q=85&s=64f9fdc6309ac3b5a96d2cf1cad9e4a0" 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-brendan-add-sof-link/4e0tdWXXIKi1QWpK/images/studio/sso/certificates-secrets-with-new-client-secret.png?fit=max&auto=format&n=4e0tdWXXIKi1QWpK&q=85&s=348caa92182638094c8be38fddd32d8b" 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-brendan-add-sof-link/4e0tdWXXIKi1QWpK/images/studio/sso/organization-settings-with-ai-rbac-scim.png?fit=max&auto=format&n=4e0tdWXXIKi1QWpK&q=85&s=f5286d46d8fab2bfb950c8666955c3cc" 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-brendan-add-sof-link/4e0tdWXXIKi1QWpK/images/studio/sso/connect-openid-provider-for-organization.png?fit=max&auto=format&n=4e0tdWXXIKi1QWpK&q=85&s=c91aad261d13953bb58e5299828e0611" 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-brendan-add-sof-link/4e0tdWXXIKi1QWpK/images/studio/sso/configure-group-mappers-for-roles.png?fit=max&auto=format&n=4e0tdWXXIKi1QWpK&q=85&s=253b3935f79b79f3c922e1749376ef10" 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-brendan-add-sof-link/4e0tdWXXIKi1QWpK/images/studio/sso/groups-list-in-microsoft-entra.png?fit=max&auto=format&n=4e0tdWXXIKi1QWpK&q=85&s=9659b4f39c28363316e60c937e74c406" 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-brendan-add-sof-link/4e0tdWXXIKi1QWpK/images/studio/sso/oidc-provider-configuration-steps.png?fit=max&auto=format&n=4e0tdWXXIKi1QWpK&q=85&s=d4fde4c151a80bfff14874c685500bff" 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-brendan-add-sof-link/4e0tdWXXIKi1QWpK/images/studio/sso/add-redirect-uri-in-azure-ad-registration.png?fit=max&auto=format&n=4e0tdWXXIKi1QWpK&q=85&s=5149afaf1cf52ad6672bf69bd04edecc" 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-brendan-add-sof-link/4e0tdWXXIKi1QWpK/images/studio/sso/token-configuration-with-group-claims.png?fit=max&auto=format&n=4e0tdWXXIKi1QWpK&q=85&s=6ee86e08568d12323cb437b20bf82a44" 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-brendan-add-sof-link/lp_f9DXOip40YgZM/images/studio/sso/add-microsoft-graph-api-permissions.png?fit=max&auto=format&n=lp_f9DXOip40YgZM&q=85&s=d5f394072f0abcc8434c16a465e309b3" 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-brendan-add-sof-link/4e0tdWXXIKi1QWpK/images/studio/sso/add-user-or-group-in-entra.png?fit=max&auto=format&n=4e0tdWXXIKi1QWpK&q=85&s=b7455e1b848ad62bb561bf4011866f50" 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-brendan-add-sof-link/4e0tdWXXIKi1QWpK/images/studio/sso/create-new-user-in-entra.png?fit=max&auto=format&n=4e0tdWXXIKi1QWpK&q=85&s=9a4ed0bdf6bd1b602d67dbe1f49f7b3e" 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-brendan-add-sof-link/4e0tdWXXIKi1QWpK/images/studio/sso/create-new-user-form-in-entra.png?fit=max&auto=format&n=4e0tdWXXIKi1QWpK&q=85&s=6c6a9ccfcc061466351b3045e265f676" 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-brendan-add-sof-link/4e0tdWXXIKi1QWpK/images/studio/sso/new-user-creation-form-in-entra.png?fit=max&auto=format&n=4e0tdWXXIKi1QWpK&q=85&s=efdbeb32b304a2fe0600a9c865a3aa48" 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>
