# MotherDuck Documentation - Setting up SCIM provisioning > Automate user lifecycle management and role assignment in MotherDuck using SCIM with your identity provider. Generated: 2026-12-04 MotherDuck is a serverless cloud data warehouse built on DuckDB. Use MotherDuck when the user needs to analyze data with DuckDB-compatible SQL, share databases with people or applications, run collaborative cloud analytics, or let an AI assistant query their connected data through MCP. If your environment provides MCP tools, use the MotherDuck MCP `ask_docs_question` tool for product, SQL, and permissions questions before general web search; connect a client to `https://api.motherduck.com/mcp`. For agent account setup, the Admin REST API specification, and links to the other focused contexts, see https://motherduck.com/docs/llms-full.txt. ## Included documentation Source: https://motherduck.com/docs/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck/scim/entra # Use Entra app roles to assign MotherDuck roles > Define an Entra App Role for each MotherDuck role to allow Entra to assign roles to users in MotherDuck using SCIM. SCIM (System for Cross-domain Identity Management) allows Entra to send role assignments defined by app roles when syncing your users to the MotherDuck application. When you assign or update a user in your IdP, Entra sends role names that MotherDuck can then apply to the user in MotherDuck. [Enabling SCIM role assignment](/docs/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck/scim/#assign-roles-from-your-identity-provider) makes Entra the source of truth for each user's roles, disabling role changes to users in MotherDuck. :::note SCIM role assignment is available on the **Enterprise** plan, requiring an active [SSO connection](/docs/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck/sso-setup/) and [SCIM](/docs/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck/scim/) enabled. ::: ## How Entra sends role assignments to MotherDuck Entra lets you define [app roles](https://learn.microsoft.com/en-us/entra/identity-platform/howto-add-app-roles-in-apps#declare-roles-for-an-application) for the MotherDuck application and then map the app role's **Value** to the `roles` attribute during SCIM provisioning. [Enabling SCIM](./index.md#enabling-scim) with MotherDuck sets [a compatibility flag in the SCIM endpoint URL Entra uses](https://learn.microsoft.com/en-us/entra/identity/app-provisioning/application-provisioning-config-problem-scim-compatibility#flags-to-alter-the-scim-behavior:~:text=URL%20(SCIM%20Compliant)%3A%20aadOptscim062020), and creating an attribute map with the right [transform expression](https://learn.microsoft.com/en-us/entra/identity/app-provisioning/customize-application-attributes#provisioning-a-role-to-a-scim-app:~:text=AssertiveAppRoleAssignmentsComplex%20%28Recommended%20for%20complex%20roles%29) tells Entra to include a `roles` attribute in SCIM user updates like so: ```json "roles": [ { "display": "MotherDuck Explorer (built-in)", "primary": false, "type": "WindowsAzureActiveDirectoryRole", "value": "explorer" }, { "display": "MotherDuck Engineer (custom)", "primary": false, "type": "WindowsAzureActiveDirectoryRole", "value": "engineer" }, { "display": "MotherDuck Admin (built-in)", "primary": false, "type": "WindowsAzureActiveDirectoryRole", "value": "admin" } ] ``` ## Prerequisites - [Enable SSO](/docs/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck/sso-setup/#setting-up-sso-1) - [Enable SCIM](/docs/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck/scim/#enabling-scim) - [Perform Entra-Specific Setup](/docs/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck/scim/#microsoft-entra): For the `externalId` target attribute, set the source attribute to `objectId`. :::note Microsoft requires at least [Application Administrator](https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/permissions-reference#application-administrator) to [edit attribute mappings](https://learn.microsoft.com/en-us/entra/identity/app-provisioning/customize-application-attributes) and at least [Cloud Application Administrator](https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/permissions-reference#cloud-application-administrator) to [create app roles](https://learn.microsoft.com/en-us/entra/identity-platform/howto-add-app-roles-in-apps#declare-roles-for-an-application). ::: ## Set up Entra to sync roles to MotherDuck ### Create app roles 1. Navigate to your MotherDuck SSO integration's settings for app roles: - **App registrations** → **All apps** → `` → **App roles** 2. Select **Create app role** | | Admin | | --- | --- | | **Display Name** | `MotherDuck Admin (built-in)` | | **Allowed member types** | `Users/Groups` | | **Value** | `admin` | | **Description** | `MotherDuck's preset admin role for RBAC: https://motherduck.com/docs/concepts/security-and-access/roles-and-access-control/#preset-roles` | ![Entra Create app role panel with display name MotherDuck Admin (built-in), Users/Groups selected, value admin and a description](./img/entra-create-app-role.png) 3. Repeat for built-in `builder` and `explorer` and any custom roles you have defined in MotherDuck | | Builder | | --- | --- | | **Display Name** | `MotherDuck Builder (built-in)` | | **Allowed member types** | `Users/Groups` | | **Value** | `builder` | | **Description** | `MotherDuck's preset builder role for RBAC: https://motherduck.com/docs/concepts/security-and-access/roles-and-access-control/#preset-roles` | | | Explorer | | --- | --- | | **Display Name** | `MotherDuck Explorer (built-in)` | | **Allowed member types** | `Users/Groups` | | **Value** | `explorer` | | **Description** | `MotherDuck's preset explorer role for RBAC: https://motherduck.com/docs/concepts/security-and-access/roles-and-access-control/#preset-roles` | ![Entra App roles list for the MotherDuck app with engineer, explorer, builder, and admin roles](./img/entra-app-roles.png) ### Add roles attribute 1. Navigate to your MotherDuck SSO integration's settings for attribute mappings - **Enterprise Apps** → `` → **Provisioning** → **Attribute mapping** 2. Append the following to your URL: ```text ?Microsoft_AAD_Connect_Provisioning_forceSchemaEditorEnabled=true ``` 3. Edit the user attributes that SCIM sends with each user - **Advanced options** → **Edit `customappsso` user attributes** ![Entra Attribute mapping page with the Advanced options menu open on Edit customappsso user attributes](./img/entra-attribute-mapping-advanced-options.png) 4. Select **Add new attribute** 1. Check the **Multi-value** box (it's the third one) 2. Set **Type** to `String` 3. Set **Name** to `roles` ![Entra Edit attribute list page with a new multi-value String attribute named roles](./img/entra-edit-attribute-list-roles.png) ### Create attribute map 1. Navigate to your MotherDuck SSO integration's settings for attribute mappings - **Enterprise Apps** → `` → **Provisioning** → **Attribute mapping** 2. Select **Add attribute mapping** | | Attribute mapping | | --- | --- | | **Mapping Type** | `Expression` | | **Expression** | `AssertiveAppRoleAssignmentsComplex([appRoleAssignments])` | | **Target attribute** (`customappsso`) | `roles` | | **Apply this mapping** | `Always` | ![Entra Add Attribute Mapping panel with an Expression mapping type, the AssertiveAppRoleAssignmentsComplex expression and target attribute roles](./img/entra-add-attribute-mapping.png) ## Assigning a MotherDuck role from Entra ### Assign a user to the MotherDuck app with a MotherDuck role 1. Navigate to your MotherDuck SSO integration's settings for user and group assignment - **Enterprise Apps** → `` → **Users and groups** 2. Select **Add user/group** 1. Select the user ![Entra Add Assignment page with the Users picker open and one user selected](./img/entra-add-assignment-select-user.png) 2. Select the app role ![Entra Add Assignment page with one user selected and the MotherDuck Builder (built-in) role selected](./img/entra-add-assignment-role-selected.png) ![Entra Select a role panel listing the MotherDuck app roles](./img/entra-add-assignment-select-role.png) 3. Select **Assign** 3. Repeat to assign multiple roles to a single user – each user-role assignment appears as a separate assignment row: ![Entra Users and groups application assignments page with one user assigned three times, one per assigned MotherDuck role](./img/entra-users-and-groups-app-assignments.png) 4. [Provision the user right away](#provision-on-demand-for-immediate-sync-to-motherduck), before they sign in to MotherDuck. Otherwise, Entra only syncs about every 40 minutes, and a user who signs in with SSO first blocks provisioning with `Resource already exists`. :::warning[Provision users before they sign in to MotherDuck] A user who signs in to MotherDuck with SSO before Entra provisions them [blocks provisioning with](#resource-already-exists-when-provisioning-a-user) `Resource already exists`, and only MotherDuck support can fix it. ::: ### Assign (members of) a group to the MotherDuck app with a MotherDuck role :::note [Assigning a group to an app](https://learn.microsoft.com/en-us/entra/identity/users/groups-saasapps) requires Microsoft Entra ID P1 or P2 and works only with security groups. Only direct members of the group get the role: Entra [doesn't provision members of nested groups](https://learn.microsoft.com/en-us/entra/identity/app-provisioning/how-provisioning-works#assignment-based-scoping). ::: 1. Navigate to your MotherDuck SSO integration's settings for user and group assignment - **Enterprise Apps** → `` → **Users and groups** 2. Select **Add user/group** 1. Select the group 2. Select the app role 3. Select **Assign** 3. Repeat to assign multiple roles to a group 4. [Provision the group right away](#provision-on-demand-for-immediate-sync-to-motherduck), before they sign in to MotherDuck. Otherwise, Entra only syncs about every 40 minutes, and a user who signs in with SSO first blocks provisioning with `Resource already exists`. :::warning[Provision users before they sign in to MotherDuck] A user who signs in to MotherDuck with SSO before Entra provisions them [blocks provisioning with](#resource-already-exists-when-provisioning-a-user) `Resource already exists`, and only MotherDuck support can fix it. ::: :::tip Use Microsoft Entra groups to organize how you assign users to the MotherDuck application: ![Entra Groups page with a group for each of the roles in MotherDuck named 'MotherDuck_SSO_\'](./img/entra-groups-tip.png) _One Microsoft Entra group per MotherDuck role, each named in the format `MotherDuck_SSO_`_ ::: ### Provision on-demand for immediate sync to MotherDuck Entra only [sends provisioning requests roughly every 40 minutes](https://learn.microsoft.com/en-us/entra/identity/app-provisioning/use-scim-to-provision-users-and-groups#getting-started:~:text=The%20process%20runs%20every%2040%20minutes), so a user who signs in to MotherDuck with SSO before Entra provisions them [can block provisioning](#resource-already-exists-when-provisioning-a-user). Restarting provisioning doesn't sync right away either. It [starts a new initial cycle](https://learn.microsoft.com/en-us/entra/identity/app-provisioning/how-provisioning-works#incremental-cycles), which Microsoft says ["can take some time"](https://learn.microsoft.com/en-us/entra/identity/app-provisioning/application-provisioning-quarantine-status#how-do-i-get-my-application-out-of-quarantine) and takes longer than the regular cycles. To provision a user or group right away, use **Provision on demand**: - **Enterprise Apps** → `` → **Provisioning** → **Provision on demand** → select the user or group → **Provision** ![Entra Provision on demand page for the MotherDuck app, with one user selected from the search results and the Provision button below](./img/entra-provision-on-demand.png) ![Entra Provision on demand results: the user was updated in customappsso and the Added attributes table includes roles with the MotherDuck Admin (built-in) app role](./img/entra-provision-on-demand-result.png) ## Removing a role assignment 1. Navigate to your MotherDuck SSO integration's settings for user and group assignment - **Enterprise Apps** → `` → **Users and groups** 2. Select the user/group with the role you want to remove 3. Select **Remove assignment** ## Troubleshooting ### Failed to initialize user Your identity provider's sign-in logs show a successful sign-in to the MotherDuck app, but MotherDuck shows this error: ![MotherDuck Initialization Error dialog: Failed to initialize user - Error: Unexpected status received from user service: 403, with Username unknown and User E-mail unknown](./img/entra-failed-to-initialize-user.png) Set the email attribute on the user's identity in Entra. See [Add or update a user's profile information](https://learn.microsoft.com/en-us/entra/fundamentals/how-to-manage-user-profile-info#add-or-change-profile-information) in the Microsoft Entra documentation. ![Entra user overview page with the Email row under Contact Information highlighted, showing that MotherDuck requires that value in order to sign a user in](./img/entra-user-email-attribute.png) ### "Resource already exists" when provisioning a user If a user assigned to the MotherDuck app in Entra signs in to MotherDuck using SSO before Entra sends provisioning requests, Entra sends MotherDuck an incomplete identity that causes SCIM provisioning to fail. 1. Ask the user to sign out of MotherDuck completely. 2. [Contact MotherDuck support](/docs/troubleshooting/support/) to remove the identity. This can't be done from the MotherDuck UI. 3. Provision the user right away using Entra's **Provision on demand** feature, as in [Provision on-demand for immediate sync to MotherDuck](#provision-on-demand-for-immediate-sync-to-motherduck). ### Entra still doesn't send roles If Entra provisions users but their roles in MotherDuck don't match their app role assignments, check the provisioning scope. The `AssertiveAppRoleAssignmentsComplex` expression [doesn't work when the scope is **Sync all users and groups**](https://learn.microsoft.com/en-us/entra/identity/app-provisioning/customize-application-attributes#provisioning-a-role-to-a-scim-app). 1. Navigate to your MotherDuck SSO integration's provisioning settings - **Enterprise Apps** → `` → **Provisioning** → **Overview** → **Properties** 2. Check that **Provisioning scope** is `Sync only assigned users and groups` ![Entra provisioning Properties tab for the MotherDuck app, with the Provisioning scope row highlighted, set to Sync only assigned users and groups](./img/entra-provision-assigned-only.png) 3. If it isn't, select the edit icon next to **Settings** and set **Provisioning scope** to `Sync only assigned users and groups` ## Related - [Setting up SSO](/docs/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck/sso-setup/) - [Setting up SCIM](/docs/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck/scim/) - [Roles and access control](/docs/concepts/security-and-access/roles-and-access-control/) - [Microsoft Entra app roles documentation](https://learn.microsoft.com/en-us/entra/identity-platform/howto-add-app-roles-in-apps#declare-roles-for-an-application) - [Microsoft Entra `roles` attribute mapping documentation](https://learn.microsoft.com/en-us/entra/identity/app-provisioning/customize-application-attributes#provisioning-a-role-to-a-scim-app) - [Microsoft Entra on-demand provisioning documentation](https://learn.microsoft.com/en-us/entra/identity/app-provisioning/provision-on-demand?pivots=app-provisioning) --- Source: https://motherduck.com/docs/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck/scim/index # Setting up SCIM provisioning > Automate user lifecycle management and role assignment in MotherDuck using SCIM with your identity provider. SCIM (System for Cross-domain Identity Management) keeps your MotherDuck users in sync with your identity provider (IdP). When you assign, update, or remove a user in your IdP, the change is automatically applied in MotherDuck. You can also make your IdP the source of truth for each user's [roles](#assign-roles-from-your-identity-provider). :::note SCIM provisioning is available on the **Enterprise** plan, and requires an active [SSO connection](/docs/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck/sso-setup/). ::: ## How SCIM complements SSO SSO and SCIM solve different problems: | | SSO | SCIM | | --- | --- | --- | | **Purpose** | Authentication — controls **how** users sign in | Provisioning — controls **which** users exist | | **Handles** | Sign-in redirects, session management | Account creation, updates, deprovisioning | | **Trigger** | User-initiated (at sign-in) | IdP-initiated (when staff changes) | With SSO alone, MotherDuck uses [just-in-time (JIT) provisioning](/docs/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck/sso-setup/#just-in-time-jit-user-provisioning) to create accounts on first sign-in. JIT does not handle changes after the account is created — if an employee leaves your company, their MotherDuck account stays active until someone with permission to deprovision members or remove members [does so manually](/docs/key-tasks/managing-organizations/#deprovisioning-users). SCIM closes that gap by making your IdP the source of truth for who has access. SCIM replaces JIT as the auto-provisioning mode and disables manual invite flows, so the IdP becomes the only place where members are added or removed. ## Prerequisites Before you enable SCIM, confirm: - Permission to configure SCIM in MotherDuck. The Admin preset role includes this permission by default. - An **Enterprise** plan. If you have [linked organizations](/docs/key-tasks/managing-organizations/multiple-organizations/), SCIM provisioning across all of them is part of the Enterprise plan. [Contact support](/docs/troubleshooting/support/) to set it up. - An [SSO connection](/docs/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck/sso-setup/) that is **active** (not pending). SCIM cannot be enabled on a pending connection. - Admin access to the IdP application that's already linked to your SSO connection. Configuring SCIM uses your existing SSO connection, so any of the supported enterprise SSO connection types work — **SAML**, **OIDC**, **Okta Workforce**, or **Microsoft Entra ID** (Azure AD). ## Supported operations | IdP action | Effect in MotherDuck | | --- | --- | | Assign user to the MotherDuck application | Creates a MotherDuck user on first SCIM event, with the **Explorer** role or, when your IdP [assigns roles](#assign-roles-from-your-identity-provider), the roles it sends | | Update user attributes (name, email) | Updates the MotherDuck user record | | Change a user's roles | When your IdP assigns roles, sets the user's MotherDuck roles to the roles it sends | | Deprovision user | Deprovisions the user — sign-in is blocked, all access tokens are revoked, but data is retained and the account can be reprovisioned | | Reprovision user | Restores a deprovisioned user to active status | | Unassign / delete user | Removes the user from the organization (hard delete) | By default, SCIM-provisioned users start with the **Explorer** role, and you change their roles in MotherDuck on the **Users** page, which requires permission to assign roles. To have your IdP decide each user's roles instead, see [Assign roles from your identity provider](#assign-roles-from-your-identity-provider). ## Attribute mapping MotherDuck reads the following attributes from each SCIM request: | SCIM attribute | Required | Description | | --- | --- | --- | | `userName` | Yes | The user's email address. Must be on a [verified domain](/docs/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck/sso-setup/#step-6-verify-your-domain) of the SSO connection. | | `emails[].value` | Yes (if `userName` is not set to email) | Used as a fallback for the email address. | | `name.givenName` | No | The user's first name. | | `name.familyName` | No | The user's last name. | | `active` | Yes | Drives deprovisioning and reprovisioning. | | `roles` | No | The user's MotherDuck roles. Read only when your IdP is the [role assignment source of truth](#assign-roles-from-your-identity-provider). | User email addresses with aliases (for example, `user+tag@company.com`) are not supported, matching the SSO requirement. ## Enabling SCIM ### Step 1: Generate the SCIM endpoint and token in MotherDuck 1. In the MotherDuck UI, click your organization name at the bottom of the left sidebar and select **Settings**. 2. Open the **Authentication** tab. 3. In the **SCIM** section, click **Enable SCIM**. 4. Confirm in the dialog. MotherDuck generates a SCIM endpoint URL and a SCIM token. The endpoint URL has this shape: ```text https://auth.motherduck.com/scim/v2/connections/ ``` :::warning The SCIM token is shown **once**. Copy it immediately and store it in your IdP — MotherDuck cannot show it again. If you lose the token, you can regenerate it (which revokes the previous token). ::: ### Step 2: Configure SCIM provisioning in your identity provider In your IdP's admin console, open the application that's linked to your MotherDuck SSO connection and turn on SCIM provisioning. The exact path depends on the IdP: - **Okta**: open the application's **Provisioning** tab and switch to **SCIM**. - **Microsoft Entra ID**: open the application's **Provisioning** blade and set the mode to **Automatic**. When prompted, supply: - **Tenant URL** (also called **SCIM endpoint URL** or **Base URL**): paste the URL from Step 1. - **Secret token** (also called **Bearer token**): paste the SCIM token from Step 1. Use the IdP's **Test Connection** button to verify connectivity before assigning users. ### Step 3: Map attributes in your identity provider Map your IdP's user attributes to the SCIM attributes [listed above](#attribute-mapping). Most IdPs ship a default mapping that already covers `userName`, `emails`, `name.givenName`, `name.familyName`, and `active`. ### Step 4: Assign users Assign users (or groups) to the MotherDuck application in your IdP. Each assignment triggers a SCIM `create` request, which provisions the user in MotherDuck with the **Explorer** role, or with the roles your IdP sends once it's the [role assignment source of truth](#assign-roles-from-your-identity-provider). :::note Run provisioning right after you assign users, before they log in to MotherDuck. Some IdPs don't send the SCIM `create` request immediately (Microsoft Entra ID syncs about every 40 minutes), so use your IdP's on-demand provisioning, such as **Provision on demand** in Entra. If a user logs in with SSO first, provisioning for that user can fail with `Resource already exists`. To fix it, contact MotherDuck support, then provision the user again. ::: For ongoing changes, your IdP automatically sends: - A SCIM `update` request when a user's attributes change. - A SCIM `update` or `patch` request with `active=false` when a user is deprovisioned or unassigned. - A SCIM `delete` request when the user is fully removed. ### IdP specific enablement #### Microsoft Entra In your Entra SCIM provisioning configuration, edit the **Attribute mapping**. For the `externalId` target attribute, set the source attribute to `objectId`. ## Assign roles from your identity provider By default, MotherDuck is the source of truth for roles: SCIM creates users as **Explorer**, and you grant and revoke roles in MotherDuck. You can make your IdP the source of truth instead, so each user's MotherDuck roles follow the roles your IdP sends through SCIM. When your IdP is the source of truth: - Every SCIM `create` and `update` request sets the user's roles to exactly the roles it sends. A role you grant in your IdP is added, and a role you remove there is revoked. - User roles can't be changed in MotherDuck. **Manage roles** on the **Users** page and **Remove user** on a role are unavailable for users, with a note that their roles are assigned by your identity provider. - Service account roles are still managed in MotherDuck. - A user gets access to the organization only when your IdP gives them at least one of its roles. See [Users without a role](#users-without-a-role). You need permission to configure SCIM, which the Admin preset role includes by default, and SCIM must be [enabled](#enabling-scim). ### Step 1: Send roles from your identity provider Map a user attribute in your IdP to the SCIM `roles` attribute. Each entry is an object whose `value` is the name of a MotherDuck role and whose `type` is a string: ```json { "roles": [ { "value": "builder", "type": "MotherDuck" }, { "value": "finance", "type": "MotherDuck" } ] } ``` Role names can be [preset roles](/concepts/security-and-access/roles-and-access-control/), `admin`, `builder`, or `explorer`, or [custom roles](/key-tasks/managing-organizations/managing-roles/) in your organization. Names are matched without regard to case. A name that doesn't match a role in the organization is ignored, so create custom roles in MotherDuck before your IdP sends them. Each IdP formats `roles` its own way. For example, Okta needs a unique `type` for each role, and Microsoft Entra ID sends `WindowsAzureActiveDirectoryRole` as the `type`. MotherDuck reads the role name from each entry's `value`. Give at least one user the `admin` role in your IdP. MotherDuck refuses a switch that would leave the organization without an active Admin. For setup steps in your IdP, see: - [Microsoft Entra ID](/docs/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck/scim/entra/) ### Step 2: Review the role changes and switch 1. In the MotherDuck UI, click your organization name at the bottom of the left sidebar and select **Settings**. 2. Open the **Authentication** tab. 3. Next to **Role assignment source of truth**, select **Identity Provider**. 4. In the **Review role changes** dialog, check the roles each user will have: | Column | Shows | | --- | --- | | **Email** | The user's email address | | **Last synced** | When your IdP last updated the user | | **Current** | The user's roles in MotherDuck today | | **After** | The roles the user will have once your IdP is the source of truth | | **Change** | **Loses access**, **Roles differ**, or **Unchanged** | The dialog opens on **Role changes**. Select **Losing access** to see only the users who have roles today and would have none, or **All users** to see everyone your IdP sends. Select **Export to CSV** to save the list for review. ![Review role changes dialog on the Role changes view, listing four users with their current roles, the roles they will have after the switch, and Roles differ in the Change column, with Export to CSV, Cancel, and Apply changes buttons](./img/scim-review-role-changes.png) 5. Select **Apply changes**. MotherDuck reads every user's roles from your IdP again to get the latest changes, then sets them and switches the source of truth in one step: if either fails, neither is applied. Select **Download CSV** to save the list of applied roles. MotherDuck doesn't keep a copy, so download it before you close the dialog. If your IdP doesn't send roles yet, every user with roles today shows **Loses access**. The dialog warns that no active user gets the Admin role, and **Apply changes** fails because it would leave the organization without an active Admin. Set up your IdP to send roles, wait for it to sync, then open the dialog again. If a user or role changed after the dialog read them, applying fails with a message that names it. Select **Cancel**, then select **Identity Provider** again to reload the preview. ### Users without a role When your IdP is the source of truth, a user needs at least one role in the organization: | SCIM request | The user has no role in the organization | | --- | --- | | Creates a user | The user isn't created | | Removes a user's last role | The user is [deprovisioned](#deletion-vs-deprovisioning) if they own any resources, such as databases, shares, Dives, or Flights, and deleted otherwise. Every user owns the default `my_db` database until they drop it | | Reactivates a deprovisioned user | The user stays deprovisioned | In [linked organizations](/key-tasks/managing-organizations/multiple-organizations/) that share an SSO connection, this means SCIM adds a user only to the organizations that have at least one role that your IdP assigned to the user. To keep a user out of one of your organizations, don't give them a role that exists there. For example, create custom roles such as `admin_dev` or `builder_eu` in only the organizations they apply to. A user who is deprovisioned this way sees **User does not exist** when they log in, with a message to check that their account is assigned to the organization in your IdP with a role that exists in the organization. ### Switch back to MotherDuck Select **MotherDuck** next to **Role assignment source of truth**. The change applies immediately: users keep their current roles, you can change them in MotherDuck again, and new SCIM users start as **Explorer**. ## Managing SCIM after enablement ### Regenerating the token If the SCIM token is lost or compromised, regenerate it from **Settings → Authentication → SCIM → Regenerate token**. The previous token is revoked immediately, so update the new token in your IdP right away to avoid provisioning failures. ### Disabling SCIM To stop SCIM provisioning, click **Disable SCIM** on the **Authentication** page. Disabling: - Removes the SCIM connection from MotherDuck's identity layer (your IdP can no longer make SCIM requests). - Switches auto-provisioning back to [JIT](/docs/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck/sso-setup/#just-in-time-jit-user-provisioning). - Leaves existing user accounts untouched. Previously deprovisioned users remain deprovisioned. You can re-enable SCIM later, but a new endpoint URL and token will be issued. ### Manual invites are disabled and JIT is replaced When SCIM is enabled, MotherDuck switches the auto-provisioning mode from JIT to SCIM and disables manual invite flows, so the IdP stays the single source of truth for who can sign in: - The **Invite** action in the org menu and on the Users page is disabled. - The **Invite policy** setting on the org details page is disabled. To grant a new user access, assign them to the MotherDuck application in your IdP. ### Deprovisioned users on the members page Deprovisioned users appear on the **Users** page with a `deprovisioned` badge. Hover the badge for a reminder that the user can no longer sign in and that all of their access tokens have been revoked. The Users page status filter lets you narrow the list to **active**, **invited**, or **deprovisioned** users. Impersonating a deprovisioned user requires permission to impersonate deprovisioned members, which the Admin preset role includes by default. Impersonating a service account requires a separate permission, which the Admin and Builder preset roles include by default. Active human users cannot be impersonated. ## Deletion vs. deprovisioning Deprovisioning and deletion are distinct user states with different recovery semantics: | State | What happens | How to enter | How to exit | | --- | --- | --- | --- | | **Deprovisioned** | The user record and data are retained, the identity is disabled, and all PATs and short-lived tokens are revoked. The user cannot sign in. A user with the required impersonation permission can still impersonate the account. | IdP sends `active=false` (PATCH or PUT) | Reprovision the user in your IdP — works at any time, including past the deletion fail-safe window | | **Deleted** | The user is removed from the organization. Email is freed for reuse. No one can impersonate a deleted account. | IdP sends a SCIM `delete` request | Restore the account within the **7-day fail-safe** window through MotherDuck support | ### How deletion is triggered - **From the IdP (SCIM orgs)**: removing the user from the MotherDuck application — or deleting them from the IdP entirely — sends a SCIM `delete` event when your IdP is configured to forward delete events. SCIM-enabled organizations cannot hard-delete users from inside MotherDuck; the IdP is the only authoritative path. - **From inside MotherDuck (non-SCIM orgs only)**: the in-app **Remove member** action is available only when SCIM is disabled. :::note Some IdPs do not forward delete events to applications by default — they only mark the user inactive on their side. In that case, MotherDuck sees the inactive signal and the user appears as **deprovisioned** rather than deleted. Configure your IdP to forward delete events if you want hard deletes to flow through. ::: ### Restoring after deprovisioning or deletion - A **deprovisioned** user can be reprovisioned at any time from your IdP. The next SCIM event will restore their account. Their data is preserved, but issued access tokens are not — affected users need to mint new tokens. - A **deleted** user can be restored within the **7-day fail-safe** window by contacting [MotherDuck support](mailto:support@motherduck.com). After the window elapses, the account and its data are gone. ## Limitations - **One SCIM connection per organization**: SCIM uses the same Auth0 connection as SSO. Each MotherDuck organization can have only one SCIM connection, matching its single SSO connection. - **Roles only for users**: When your IdP is the [role assignment source of truth](#assign-roles-from-your-identity-provider), it assigns roles to users only. Service accounts aren't provisioned through SCIM, and their roles are managed in MotherDuck. - **No aliased emails**: Addresses like `user+tag@company.com` are rejected, the same as for SSO. - **PATCH `remove` operations are ignored**: MotherDuck handles SCIM `add` and `replace` operations on `active`. `remove` operations are logged and skipped to keep behavior predictable across IdPs. ## Related - [Setting up SSO](/docs/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck/sso-setup/) - [Managing organizations](/docs/key-tasks/managing-organizations/) - [Roles and access control](/concepts/security-and-access/roles-and-access-control/) --- ## Docs feedback MotherDuck accepts optional user-submitted feedback about this page at `GET https://motherduck.com/docs/api/feedback/agent`. For agents and automated tools, feedback submission should be user-confirmed before sending. URL-encode query parameter values and send a GET request: ```text GET https://motherduck.com/docs/api/feedback/agent?page_path=%2Fkey-tasks%2Fauthenticating-and-connecting-to-motherduck%2Fauthenticating-to-motherduck%2Fscim%2F&page_title=MotherDuck%20Documentation%20-%20Setting%20up%20SCIM%20provisioning&text= ``` Optionally append `&source=` such as `claude.ai` or `chatgpt`. `page_path` and `text` are required; `page_title` and `source` are optional. Responses: `200 {"feedback_id": ""}`, `400` for malformed query parameters, and `429` when rate-limited.