> For the complete documentation index, see [llms.txt](https://docs.igenius.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.igenius.ai/crystal-console/users/invite-users-to-crystal/invite-users-via-identity-providers/microsoft-azure.md).

# Enable the Microsoft Identity Provider

This page describes how to enable the Microsoft IDP for the Login.

<figure><img src="https://2516160394-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmAOqTQkYofJrevcpklA7%2Fuploads%2FLf0td8qYElcLzA1Rh4k6%2Fimage.png?alt=media&amp;token=56adc223-5acb-41c9-b3e2-14191e84d7cd" 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.

![](https://content.gitbook.com/content/mAOqTQkYofJrevcpklA7/blobs/jpHFeqQj42SPqAs3nZ2f/image.png)

* Now click on **+ New registration**

![](https://content.gitbook.com/content/mAOqTQkYofJrevcpklA7/blobs/EXAnoQFBCl3FfiuWUTOZ/image.png)

* 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).

![](https://content.gitbook.com/content/mAOqTQkYofJrevcpklA7/blobs/huxiHB5HqQfQdET6nP6X/image.png)

## 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.**

![](https://content.gitbook.com/content/mAOqTQkYofJrevcpklA7/blobs/AYjYRmSmqYNO8tDkYqpz/image.png)

* 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 %}

![](https://content.gitbook.com/content/mAOqTQkYofJrevcpklA7/blobs/HK8m2Uz3OrGXYBHXvNwb/image.png)

* 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).

![](https://content.gitbook.com/content/mAOqTQkYofJrevcpklA7/blobs/FG6ShdHFIjWhfFf1OHK7/image.png)

## 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**.

![](https://content.gitbook.com/content/mAOqTQkYofJrevcpklA7/blobs/Z0Zr378c9zLycsAUHubS/image.png)

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

![](https://content.gitbook.com/content/mAOqTQkYofJrevcpklA7/blobs/X7zGv4T25bot3PuYT02m/image.png)

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

![](https://content.gitbook.com/content/mAOqTQkYofJrevcpklA7/blobs/yQ96RrSTGPzHt0jCf1RP/image.png)

* 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.**

![](https://content.gitbook.com/content/mAOqTQkYofJrevcpklA7/blobs/2gnuLRYfvkhJRwXN7ggg/image.png)

{% 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="https://2516160394-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmAOqTQkYofJrevcpklA7%2Fuploads%2FtQQff8dmuIu1bxXqNRff%2Fimage.png?alt=media&amp;token=8e045eca-fcce-47fe-9e94-56ec41ac1bc1" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2516160394-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmAOqTQkYofJrevcpklA7%2Fuploads%2FgfIWFn2a9k9cpfd2BGGB%2Fimage.png?alt=media&amp;token=11a76193-e32d-459d-a0ae-c28ddf1bdca3" alt=""><figcaption></figcaption></figure>

* Select **Azure Active Directory.**

![](https://content.gitbook.com/content/mAOqTQkYofJrevcpklA7/blobs/PHR2VP6O6lSYoqwNIhrh/image.png)

* 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.

![](https://content.gitbook.com/content/mAOqTQkYofJrevcpklA7/blobs/QizxKUZeQ2W836pE6Fs8/image.png)

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.

![](https://content.gitbook.com/content/mAOqTQkYofJrevcpklA7/blobs/nC49HoQQNIMNo2ZQkZPw/image.png)

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.

![](https://content.gitbook.com/content/mAOqTQkYofJrevcpklA7/blobs/aEfYKQfJjknSGd2JNrCX/secret%20value%20\(1\).png)

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

![](https://content.gitbook.com/content/mAOqTQkYofJrevcpklA7/blobs/hbUbY2cOqaXlEheGlXwH/image.png)

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)).

***
