> ## Documentation Index
> Fetch the complete documentation index at: https://wundergraphinc-ahmet-eng-8587-documentation-for-connect-cli.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-ahmet-eng-8587-documentation-for-connect-cli/4bDdzZZwotgzjNTa/images/studio/sso/image-34.png?fit=max&auto=format&n=4bDdzZZwotgzjNTa&q=85&s=fb44da0c870902fae32ff8e2292c1b8d" width="2304" height="1255" data-path="images/studio/sso/image-34.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-ahmet-eng-8587-documentation-for-connect-cli/4bDdzZZwotgzjNTa/images/studio/sso/image-35.png?fit=max&auto=format&n=4bDdzZZwotgzjNTa&q=85&s=607efe977bc4e2b0d8050372dc22ce15" width="2304" height="1252" data-path="images/studio/sso/image-35.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-ahmet-eng-8587-documentation-for-connect-cli/4bDdzZZwotgzjNTa/images/studio/sso/image-36.png?fit=max&auto=format&n=4bDdzZZwotgzjNTa&q=85&s=7f9b26c21d45f0996a6dd0e206082152" width="2304" height="1253" data-path="images/studio/sso/image-36.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-ahmet-eng-8587-documentation-for-connect-cli/4bDdzZZwotgzjNTa/images/studio/sso/image-37.png?fit=max&auto=format&n=4bDdzZZwotgzjNTa&q=85&s=ad4a93f85293142a58ebeb9f5029d8ea" width="2304" height="1186" data-path="images/studio/sso/image-37.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-ahmet-eng-8587-documentation-for-connect-cli/4bDdzZZwotgzjNTa/images/studio/sso/image-38.png?fit=max&auto=format&n=4bDdzZZwotgzjNTa&q=85&s=ff96a11b80e71e35e6be7f116d0d96b0" width="2304" height="1240" data-path="images/studio/sso/image-38.png" />
    </Frame>
  </Step>

  <Step>
    Navigate to the settings page on Cosmo.

    <Frame>
      <img src="https://mintcdn.com/wundergraphinc-ahmet-eng-8587-documentation-for-connect-cli/4bDdzZZwotgzjNTa/images/studio/sso/connect_oidc.png?fit=max&auto=format&n=4bDdzZZwotgzjNTa&q=85&s=a63e1ded8ec97a6b332920dd52cdcd55" width="2796" height="1902" data-path="images/studio/sso/connect_oidc.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-ahmet-eng-8587-documentation-for-connect-cli/4bDdzZZwotgzjNTa/images/studio/sso/image-40.png?fit=max&auto=format&n=4bDdzZZwotgzjNTa&q=85&s=4b01a7bbd828d881d61fe94f66324067" width="1536" height="856" data-path="images/studio/sso/image-40.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-ahmet-eng-8587-documentation-for-connect-cli/4bDdzZZwotgzjNTa/images/studio/sso/image-41.png?fit=max&auto=format&n=4bDdzZZwotgzjNTa&q=85&s=debd42615b71424659fb2b26613fa35e" width="1536" height="841" data-path="images/studio/sso/image-41.png" />
    </Frame>

    <br />

    <Frame caption="Object ID of the groups in Entra">
      <img src="https://mintcdn.com/wundergraphinc-ahmet-eng-8587-documentation-for-connect-cli/4bDdzZZwotgzjNTa/images/studio/sso/image-42.png?fit=max&auto=format&n=4bDdzZZwotgzjNTa&q=85&s=74cc116138ef1eae20c5945724b0e3d4" width="2304" height="1254" data-path="images/studio/sso/image-42.png" />
    </Frame>
  </Step>

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

    <Frame>
      <img src="https://mintcdn.com/wundergraphinc-ahmet-eng-8587-documentation-for-connect-cli/4bDdzZZwotgzjNTa/images/studio/sso/image-43.png?fit=max&auto=format&n=4bDdzZZwotgzjNTa&q=85&s=b8cfe24193878eaf89c9ced7f0ba1595" width="1513" height="824" data-path="images/studio/sso/image-43.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-ahmet-eng-8587-documentation-for-connect-cli/4bDdzZZwotgzjNTa/images/studio/sso/image-44.png?fit=max&auto=format&n=4bDdzZZwotgzjNTa&q=85&s=a1ed122b297af855982a476ee251a1fc" width="2304" height="1258" data-path="images/studio/sso/image-44.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-ahmet-eng-8587-documentation-for-connect-cli/4bDdzZZwotgzjNTa/images/studio/sso/image-45.png?fit=max&auto=format&n=4bDdzZZwotgzjNTa&q=85&s=3b73229c2453b3e5fb2cf46428696cbd" width="2304" height="1188" data-path="images/studio/sso/image-45.png" />
    </Frame>
  </Step>

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

    <Frame>
      <img src="https://mintcdn.com/wundergraphinc-ahmet-eng-8587-documentation-for-connect-cli/4bDdzZZwotgzjNTa/images/studio/sso/image-46.png?fit=max&auto=format&n=4bDdzZZwotgzjNTa&q=85&s=1b7faa8b29acab15b707bb6f4ed35808" width="2304" height="1187" data-path="images/studio/sso/image-46.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-ahmet-eng-8587-documentation-for-connect-cli/4bDdzZZwotgzjNTa/images/studio/sso/image-47.png?fit=max&auto=format&n=4bDdzZZwotgzjNTa&q=85&s=2766c88e193e0abee5bef5481b741750" width="2304" height="1254" data-path="images/studio/sso/image-47.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-ahmet-eng-8587-documentation-for-connect-cli/4bDdzZZwotgzjNTa/images/studio/sso/image-48.png?fit=max&auto=format&n=4bDdzZZwotgzjNTa&q=85&s=0edfe9cca136f3e055ca256842d7a6db" width="2304" height="1254" data-path="images/studio/sso/image-48.png" />
      </Frame>
    </Step>

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

      <Frame>
        <img src="https://mintcdn.com/wundergraphinc-ahmet-eng-8587-documentation-for-connect-cli/4bDdzZZwotgzjNTa/images/studio/sso/image-49.png?fit=max&auto=format&n=4bDdzZZwotgzjNTa&q=85&s=2abd40244b0725c57625f0855f04da74" width="2304" height="1251" data-path="images/studio/sso/image-49.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-ahmet-eng-8587-documentation-for-connect-cli/4bDdzZZwotgzjNTa/images/studio/sso/image-50.png?fit=max&auto=format&n=4bDdzZZwotgzjNTa&q=85&s=ef1b1867915d70957f80e5e34c1a4281" width="2304" height="1185" data-path="images/studio/sso/image-50.png" />
      </Frame>
    </Step>

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