# Enable the Microsoft Identity Provider

<figure><img src="/files/WwMERyFqpCP5jKehNrSE" alt=""><figcaption><p>Login with Microsoft IDP</p></figcaption></figure>

To let Member Users log in to Crystal with their Microsoft credentials, the Admin User must first setup Microsoft Azure as an Identity Provider.&#x20;

To do so, as an Admin, you must follow a process that involves both **Azure** and **Crystal**.

Please follow through this tutorial.

{% hint style="info" %} <mark style="color:blue;">**Please Note**</mark>

Identity Providers can also be used to [*create new Groups*](/crystal-console/users/user-groups.md).
{% endhint %}

## Step 1 - **Add an app registration on the Microsoft Azure Portal**

* First, you need to log in to [Microsoft Azure.](http://portal.azure.com/)
* Then search for **App registrations** in the upper search bar.

![](/files/NuUQtfbHtqMUYZv2Lqw6)

* Now click on **+ New registration**

![](/files/FhYVsllULlNyWBVzbB4H)

* You will now need to fill in the App registration form through the following passages:

1. choose a name for registering the crystal app on Azure (for example, you might use[ crystal.ai](http://crystal.ai/));
2. select the correct account types that you want to support. If you choose **Accounts** on this organizational directory only, only the accounts registered in the current Azure AD will be able to login to crystal;
3. provide a redirect URI for OAuth2 (you can configure it later, but the structure should be: https\://{your-crystal-tenant-name}.crystal.ai/login-manager/login/azure/complete).

![](/files/2pSXf0GoXQZy7n89RARI)

## Step 2 - **Create a client secret for the App**

After following the Step 1 instructions, you will be able to see your new App registration among the App registrations. You will now need to create a client secret, by following these steps:

* On the left menu, click on **Certificates & secrets.**

![](/files/PDDlmRZa9mWvQK6eC414)

* On the **Client secrets tab**, click on **+ New client secret**, then choose a meaningful name and an expiration time that suits your needs. &#x20;

{% hint style="info" %}
Remember that when the secret expires, you will have to reconfigure crystal, so we recommend to choose a **Custom duration** and keep it long enough not to be affected by expirations.
{% endhint %}

![](/files/sX2hPxeuVN8w4V7iLPrW)

* Copy the secret value and **keep it somewhere safe**: you will need it later, when you will configure crystal in **Step 4** (it’s the Secret Code in the IDP form).

![](/files/yF150VIUqGZQ07YSJhDs)

## Step 3 - Give the proper API permissions to the App

* On the left menu, click on **API permissions**. You should see the **User.Read permission** already configured. Click on **+Add a permission**.

![](/files/7Qrcyg2uEAyhJ5DVrwS7)

* Now click on the **Microsoft Graph** banner.

![](/files/Da0D1z9ZjGUdmuQWmYvj)

* Click on **Application permissions** and search for **Group**, then flag the option **Group.Read.All permission.**

![](/files/iLgmKBlOaUY8xPd8szyu)

* If you’re not the directory administrator, you should see an orange sign on the status (instead of a green circle). In this case you should ask your admin to consent to the newly added permissions. If, instead, you’re the admin, you can grant them **by clicking on Grant admin consent for.**

![](/files/aWil1sbQbdSUX8vF84ZJ)

{% hint style="info" %} <mark style="color:blue;">**Please Note**</mark>

In total, you have to add 4 permissions:

* **User.Read** - already configured
* **User.Read.All** - to add manually
* **Group.Read.All** - to add manually
* **GroupMember.Read.All** - to add manually
  {% endhint %}

## **Step 4 - Configure the Microsoft Azure IDP in the crystal Console**

* Log in to the crystal Self-Service Console and go to the Users tab. Click on the Identity Provider label, then click on **Add new IDP.**

<figure><img src="/files/qVISQSEYdWQSe0ad7wHL" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/camEGXlju7iJ5nZG4dFI" alt=""><figcaption></figcaption></figure>

* Select **Azure Active Directory.**

![](/files/EQTQy9qYifAgSTqoUtxl)

* Now you need to fill in the form with the App registration credentials you configured in the previous steps of this guide.

**Here is where you can find the credentials you need:**

1. You will find **Client ID** and **Tenant ID** by clicking on **Overview** from the left menu of your crystal app registration on the Azure portal.

![](/files/9mjUlqbcjKhW2upztQsb)

2\. You can find the **Redirect URI** by clicking on **Authentication** from the left menu of your crystal app registration on the Azure portal. It must be the same and the structure must be  https\://{your-crystal-tenant-name}.crystal.ai/login-manager/login/azure/complete.

![](/files/i8wNryvFbCU35I08BTkM)

3\. The **Secret Code** can be found by clicking on **Certificates & Secrets** from the left menu of your crystal app registration on the Azure portal. Mind that, if you didn’t save it before, you will have to create a new one.

![](/files/K9030gFpsIVuWjYUkKQR)

* Once the form is filled with the above mentioned credentials, click on **Test and Connect.**

![](/files/eEoFPnz3zKKGJQx0tYIo)

If the connection succeeds, you’ll be capable to [invite Users](/crystal-console/users/invite-users-to-crystal/invite-users-via-identity-providers.md) from Azure and *enable the Login via Microsoft credentials for them* (and to easily create [new groups](/crystal-console/users/user-groups.md)).

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.igenius.ai/crystal-console/users/invite-users-to-crystal/invite-users-via-identity-providers/microsoft-azure.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
