|
| 1 | +# How to configure SCIM with Microsoft Entra ID (Azure AD) |
| 2 | + |
| 3 | +This guide explains how to set up automatic user and group provisioning between Microsoft Entra ID and your Hugging Face organization using SCIM. |
| 4 | + |
| 5 | +<Tip warning={true}> |
| 6 | +This feature is part of the <a href="https://huggingface.co/contact/sales?from=enterprise" target="_blank">Enterprise Plus</a> plan. |
| 7 | +</Tip> |
| 8 | + |
| 9 | +### Step 1: Get SCIM configuration from Hugging Face |
| 10 | + |
| 11 | +1. Navigate to your organization's settings page on Hugging Face. |
| 12 | +2. Go to the **SSO** tab, then click on the **SCIM** sub-tab. |
| 13 | +3. Copy the **SCIM Tenant URL**. You will need this for the Entra ID configuration. |
| 14 | +4. Click **Generate an access token**. A new SCIM token will be generated. Copy this token immediately and store it securely, as you will not be able to see it again. |
| 15 | + |
| 16 | +<div class="flex justify-center"> |
| 17 | + <img class="block dark:hidden" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/sso/scim-settings.png"/> |
| 18 | + <img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/sso/scim-settings-dark.png"/> |
| 19 | +</div> |
| 20 | + |
| 21 | +### Step 2: Configure Provisioning in Microsoft Entra ID |
| 22 | + |
| 23 | +1. In the Microsoft Entra admin center, navigate to your Hugging Face Enterprise Application. |
| 24 | +2. In the left-hand menu, select **Provisioning**. |
| 25 | +3. Click **Get started**. |
| 26 | +4. Change the **Provisioning Mode** from "Manual" to **Automatic**. |
| 27 | + |
| 28 | +### Step 3: Enter Admin Credentials |
| 29 | + |
| 30 | +1. In the **Admin Credentials** section, paste the **SCIM Tenant URL** from Hugging Face into the **Tenant URL** field. |
| 31 | +2. Paste the **SCIM token** from Hugging Face into the **Secret Token** field. |
| 32 | +3. Click **Test Connection**. You should see a success notification. |
| 33 | +4. Click **Save**. |
| 34 | + |
| 35 | +<div class="flex justify-center"> |
| 36 | + <img class="block dark:hidden" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/sso/scim-entra-creds.png" alt="Entra ID SCIM Admin Credentials"/> |
| 37 | + <img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/sso/scim-entra-creds-dark.png" alt="Entra ID SCIM Admin Credentials"/> |
| 38 | +</div> |
| 39 | + |
| 40 | +### Step 4: Configure Attribute Mappings |
| 41 | + |
| 42 | +1. Under the **Mappings** section, click on **Provision Microsoft Entra ID Users**. |
| 43 | +2. The default attribute mappings often require adjustments for robust provisioning. We recommend using the following configuration. You can delete attributes that are not listed here: |
| 44 | + |
| 45 | + | `customappsso` Attribute | Microsoft Entra ID Attribute | Matching precedence | |
| 46 | + |---|---|---| |
| 47 | + | `userName` | `Replace([mailNickname], ".", "", "", "", "", "")` | | |
| 48 | + | `active` | `Switch([IsSoftDeleted], , "False", "True", "True", "False")` | | |
| 49 | + | `emails[type eq "work"].value` | `userPrincipalName` | | |
| 50 | + | `name.givenName` | `givenName` | | |
| 51 | + | `name.familyName` | `surname` | | |
| 52 | + | `name.formatted` | `Join(" ", [givenName], [surname])` | | |
| 53 | + | `externalId` | `objectId` | `1` | |
| 54 | + |
| 55 | +3. After configuring the user mappings, go back to the Provisioning screen and click on **Provision Microsoft Entra ID Groups** to review group mappings. The default settings for groups are usually sufficient. |
| 56 | + |
| 57 | +### Step 5: Start Provisioning |
| 58 | + |
| 59 | +1. On the main Provisioning screen, set the **Provisioning Status** to **On**. |
| 60 | +2. Under **Settings**, you can configure the **Scope** to either "Sync only assigned users and groups" or "Sync all users and groups". We recommend starting with "Sync only assigned users and groups". |
| 61 | +3. Save your changes. |
| 62 | + |
| 63 | +The initial synchronization can take up to 40 minutes to start. You can monitor the progress in the **Provisioning logs** tab. |
| 64 | + |
| 65 | +#### Assigning Users and Groups for Provisioning |
| 66 | + |
| 67 | +To control which users and groups are provisioned to your Hugging Face organization, you need to assign them to the Hugging Face Enterprise Application in Microsoft Entra ID. This is done in the **Users and groups** tab of your application. |
| 68 | + |
| 69 | +1. Navigate to your Hugging Face Enterprise Application in the Microsoft Entra admin center. |
| 70 | +2. Go to the **Users and groups** tab. |
| 71 | +3. Click **Add user/group**. |
| 72 | +4. Select the users and groups you want to provision and click **Assign**. |
| 73 | + |
| 74 | +<div class="flex justify-center"> |
| 75 | + <img class="block dark:hidden" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/sso/scim-entra-users-groups.png" alt="Entra ID SCIM User and Group Assignment"/> |
| 76 | + <img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/sso/scim-entra-users-groups-dark.png" alt="Entra ID SCIM User and Group Assignment"/> |
| 77 | +</div> |
| 78 | + |
| 79 | +Only the users and groups you assign here will be provisioned to Hugging Face if you have set the **Scope** to "Sync only assigned users and groups". |
| 80 | + |
| 81 | +<Tip> |
| 82 | +<p><strong>Active Directory Plan Considerations</strong></p> |
| 83 | +<ul> |
| 84 | +<li>With <strong>Free, Office 365, and Premium P1/P2 plans</strong>, you can assign individual users to the application for provisioning.</li> |
| 85 | +<li>With <strong>Premium P1/P2 plans</strong>, you can also assign groups. This is the recommended approach for managing access at scale, as you can manage group membership in AD, and the changes will automatically be reflected in Hugging Face.</li> |
| 86 | +</ul> |
| 87 | +</Tip> |
| 88 | + |
| 89 | +### Step 6: Verify Provisioning in Hugging Face |
| 90 | + |
| 91 | +Once the synchronization is complete, navigate back to your Hugging Face organization settings: |
| 92 | +- Provisioned users will appear in the **Users Management** tab. |
| 93 | +- Provisioned groups will appear in the **SCIM** tab under **SCIM Groups**. These groups can then be assigned to [Resource Groups](./security-resource-groups) for fine-grained access control. |
| 94 | + |
| 95 | +### Step 7: Link SCIM Groups to Hugging Face Resource Groups |
| 96 | + |
| 97 | +Once your groups are provisioned from Entra ID, you can link them to Hugging Face Resource Groups to manage permissions at scale. This allows all members of a SCIM group to automatically receive specific roles (like read or write) for a collection of resources. |
| 98 | + |
| 99 | +1. In your Hugging Face organization settings, navigate to the **SSO** -> **SCIM** tab, You will see a list of your provisioned groups under **SCIM Groups**. |
| 100 | + |
| 101 | +<div class="flex justify-center"> |
| 102 | + <img class="block dark:hidden" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/sso/scim-provisioned-group.png" alt="Link SCIM group to a resource group"/> |
| 103 | + <img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/sso/scim-provisioned-group-dark.png" alt="Link SCIM group to a resource group"/> |
| 104 | +</div> |
| 105 | + |
| 106 | +3. Locate the group you wish to configure and click **Link resource groups** in its row. |
| 107 | +4. A dialog will appear. Click **Link a Resource Group**. |
| 108 | +5. From the dropdown menus, select the **Resource Group** you want to link and the **Role Assignment** you want to grant to the members of the SCIM group. |
| 109 | +6. Click **Link to SCIM group** and save the mapping. |
| 110 | + |
| 111 | + |
0 commit comments