Skip to content

Provision users with SCIM

A SCIM connection lets a directory that your organization already runs, such as Microsoft Entra ID, Okta, or any other SCIM 2.0 client, push users and groups into one Authwise realm and keep them current. You create the connection on the realm, create a token for it, and give the directory two values: the connection’s base URL and the token.

SCIM creates accounts. It never sets a password and never signs anyone in. The people a directory pushes sign in through a sign-in method of the realm, usually the same directory over SAML or OpenID Connect.

  • Identity server 1.92 or later.
  • The console at 0.55 or later, awctl 0.45 or later, or Terraform provider 0.35 or later.
  • A tenant administrator seat, or a service account holding tenant.admin or identity.admin. With home administration, the roles are administration.admin and administration.identity. Viewer roles can read connections and tokens and can’t create a token. See Tenants.
  • A realm that isn’t the administration realm, and an issuer that routes to it. The issuer must be bound to a domain, because its host serves the connection’s base URL. See Realms and Domains and issuers.
  • Optional: a federated sign-in method in the realm, such as SAML or OpenID Connect, for the pushed people to sign in through.
  • Rights on the directory side to configure provisioning for an application.

A connection can name one federated sign-in method of its realm. For each user the directory pushes, Authwise then records an identifier under that sign-in method, taken from the SCIM attribute you choose. When the person signs in through the sign-in method and it asserts the same identifier, Authwise matches the pushed account. No account is created at sign-in, so the realm can keep just-in-time federation closed and admit only the people the directory pushed.

Without a sign-in method, the connection keeps profiles only. The accounts exist, and the people sign in however the realm offers.

A password or magic-link sign-in method can’t be named, because a pushed user has no credential to use with it.

A realm creates pushed users only when its SCIM channel is open. The channel is closed until you open it. While it’s closed, a directory can read and update the realm’s existing users, and each attempt to create a user is refused with 403.

  1. In the console, open the realm and go to the Sign-up tab.
  2. Turn on A directory pushes them (SCIM).
  3. Save the change.

With awctl, set provisioning.scim to true in the realm’s configuration:

Terminal window
awctl identity realms edit REALM_ID --tenant-id TENANT_ID

Replace REALM_ID and TENANT_ID with the realm’s and the tenant’s IDs. The command opens the realm in your editor.

With Terraform, set the channel in the authwise_realm_config data source:

data "authwise_realm_config" "staff" {
provisioning = {
scim = true
}
}
resource "authwise_realm" "staff" {
display_name = "Staff"
config = data.authwise_realm_config.staff.json
}
  1. In the console, open the realm and go to the SCIM tab.
  2. Click New SCIM connection.
  3. In Name, enter a name for the directory, for example Entra ID.
  4. In Issuer, select the issuer whose host serves the connection. Only issuers that route to this realm are offered.
  5. Optional: in Sign-in method, select the federated sign-in method the pushed people sign in through.
  6. In Identifier from, select the SCIM attribute that becomes each person’s identifier under the sign-in method.
  7. In When the directory deletes a person, select Turn the account off or Delete the account.
  8. Click Create connection. The connection’s page opens and shows its SCIM base URL.

With awctl:

Terminal window
awctl identity scim-connections create \
--tenant-id TENANT_ID --realm-id REALM_ID \
--display-name "Entra ID" \
--issuer-id ISSUER_ID \
--provider-id PROVIDER_ID
awctl identity scim-connections describe SCIM_CONNECTION_ID \
--tenant-id TENANT_ID --realm-id REALM_ID

Replace the following:

  • TENANT_ID and REALM_ID: the tenant and the realm. Leave the flags out to use the ones in your profile’s context.
  • ISSUER_ID: the issuer whose host serves the base URL.
  • PROVIDER_ID: the federated sign-in method. Leave the flag out to keep profiles only.
  • SCIM_CONNECTION_ID: the ID that create prints, which starts with sc-.

With Terraform:

resource "authwise_scim_connection" "directory" {
realm_id = authwise_realm.staff.realm_id
display_name = "Entra ID"
issuer_id = authwise_issuer.staff.issuer_id
provider_id = authwise_provider.directory.provider_id
}
output "scim_base_url" {
value = authwise_scim_connection.directory.base_url
}
Consoleawctl flagTerraform attributeMeaning
Name--display-namedisplay_nameA name for the directory. Required.
Issuer--issuer-idissuer_idThe issuer whose host serves the base URL. Required. It must route to the connection’s realm.
Sign-in method--provider-idprovider_idOptional. A federated sign-in method of the realm. Each pushed user gets an identifier under it.
Identifier from--identifier-attributeidentifier_attributeThe SCIM attribute that becomes the identifier: userName (the default), externalId, or emails.primary. Choose the one whose value equals what the sign-in method asserts for the person.
When the directory deletes a person--on-deleteon_deletedeactivate (the default) turns the account off. delete deletes it.
Turn off and Turn on--statusstatusactive (the default) or disabled. A disabled connection refuses every request and keeps its tokens.

The directory authenticates with a bearer token that belongs to one connection. Authwise generates the token, shows it once, and stores only a hash. You can’t supply your own token, and no later read returns it.

  1. On the connection’s page, in Tokens, click Make a token.
  2. In Expires, select when the token stops working: Never, In 30 days, In 90 days, In a year, or On a date….
  3. Click Make token.
  4. Click Copy, and store the token where the directory’s setup can use it.
  5. Click I have copied it.

With awctl:

Terminal window
awctl identity scim-tokens create \
--tenant-id TENANT_ID --realm-id REALM_ID \
--scim-connection-id SCIM_CONNECTION_ID \
--expires-at 2027-11-16T00:00:00Z \
--out scim.token

--expires-at is an RFC 3339 time in the future. Without it, the token never expires. --out names a new file, which awctl writes with mode 0600 and never overwrites. Without --out, the token alone goes to standard output, so that you can pipe it into a secret store.

With Terraform:

resource "authwise_scim_token" "directory" {
realm_id = authwise_realm.staff.realm_id
scim_connection_id = authwise_scim_connection.directory.scim_connection_id
expires_at = "2027-11-16T00:00:00Z"
}
output "scim_secret" {
value = authwise_scim_token.directory.secret
sensitive = true
}

Give the directory these two values:

ValueWhere it comes fromCommon names in a directory
The base URLSCIM base URL on the connection’s page, base_url from awctl identity scim-connections describe, or the base_url attribute in TerraformTenant URL, SCIM connector base URL
The tokenThe token you createdSecret token, API token, bearer token

The base URL has this form:

https://login.example.com/scim/SCIM_CONNECTION_ID/v2

The host is the issuer’s. The directory adds /Users, /Groups, and the other SCIM paths. A connection whose issuer has no host has no base URL yet.

Set the directory to authenticate with an HTTP header bearer token. In the directory’s attribute mappings:

  • Turn off password synchronization. Authwise refuses any request that carries a password.
  • Map userName. It’s required and unique in the realm.
  • Map externalId to the directory’s own ID for the person or group, so that a rename in the directory doesn’t break the match.
SCIM attributeIn Authwise
idThe user’s ID, assigned by Authwise.
userNameThe user name (the preferred_username claim). Required. Unique in the realm, without regard to case.
externalIdThe user’s external ID. Unique in the realm.
name.givenName, name.familyName, name.middleNameGiven, family, and middle name.
displayNameDisplay name. When it’s absent, name.formatted is used.
nickNameNickname.
profileUrlProfile URL.
photosThe primary photo, or else the first, becomes the picture.
preferredLanguage, localeLocale. preferredLanguage wins when both are sent.
timezoneTime zone.
activetrue turns the account on, and false turns it off. When it’s absent, the account keeps its state.
emails, phoneNumbersStored and returned as sent. With a sign-in method on the connection, the primary email address and phone number, or else the first, are also recorded on the person’s sign-in identifier as what the directory asserts. They’re never treated as verified.
title, userType, addresses, ims, entitlements, roles, x509CertificatesStored and returned as sent. Authwise doesn’t interpret them.
Enterprise extension (employeeNumber, department, manager, and the rest)Stored and returned as sent.
Other extension schemasStored and returned as sent, under the schema’s URN.
passwordRefused with 400.
groupsRead-only. Change membership on the group.
SCIM attributeIn Authwise
idThe group’s ID, assigned by Authwise.
displayNameThe group’s display name. Required. Unique in the realm.
externalIdThe group’s external ID. Unique in the realm.
membersThe group’s users. Each value must be the Authwise ID of a user of the same realm. An unknown ID refuses the whole request.

A person can belong to at most 200 groups. Authwise refuses a membership change that would take a person past that number.

  • Supported: create, read, replace (PUT), patch, and delete for users and groups, and the discovery documents /ServiceProviderConfig, /Schemas, and /ResourceTypes.
  • Filters: eq on userName, externalId, id, active, and email address for users, and on displayName, externalId, and id for groups. co and sw work on userName and displayName. Terms combine with and only.
  • Paging: startIndex and count, with at most 200 results in a page.
  • Not supported: bulk operations, sorting, ETags, password change, /Me, and /.search.

A directory’s reads cover every user and group in the realm, however each was created. So the directory’s matching step can find an existing account by userName or externalId and update it instead of creating a duplicate. A POST for a userName or externalId that’s taken is refused with 409.

Each user and group belongs to the connection that created it or first wrote it. When a realm has more than one connection:

  • Any connection can read every user and group.
  • Only the owning connection can change or delete a user or group. Another connection gets 403.
  • A user or group that no connection owns, such as an account that existed before, belongs to the first connection that writes it.

An administrator can’t edit a user that a directory created. The Admin API refuses the change and names the user’s origin. Change the person in the directory.

A federated sign-in doesn’t overwrite the profile of a user that a directory created. The token’s claims come from the profile the directory pushed.

What happens when the directory removes a person

Section titled “What happens when the directory removes a person”
The directory sendsResult
active: falseThe account is turned off. The person’s refresh tokens are revoked at once. An access token that was already issued stays valid until it expires.
active: trueThe account is turned on. Revoked tokens aren’t restored. The person signs in again.
DELETE, with Turn the account off (deactivate)The same as active: false. The account stays and can be turned on again.
DELETE, with Delete the account (delete)The account and everything the person holds are deleted: sign-in identifiers, group memberships, authenticators, consents, and refresh tokens. A second DELETE returns 404.
DELETE on a groupThe group and its memberships are deleted. The users stay.

Directories differ in when they send DELETE. Many turn an account off first and delete it later, or never. Keep Turn the account off unless you need the account erased.

A connection can hold several working tokens, so you can rotate without a gap. A token can’t be changed after it’s made.

  1. Create a second token for the connection.
  2. Put the new token in the directory, and confirm that the directory still connects.
  3. In the console, on the connection’s page, click the revoke button on the old token’s row, and then click Revoke token.

With awctl, list the tokens and delete the old one:

Terminal window
awctl identity scim-tokens list --tenant-id TENANT_ID --realm-id REALM_ID
awctl identity scim-tokens delete SCIM_TOKEN_ID \
--tenant-id TENANT_ID --realm-id REALM_ID

SCIM_TOKEN_ID starts with st-. It’s also the part of the token before the first underscore.

With Terraform, changing expires_at or scim_connection_id replaces the token, and the old token stops working when it’s destroyed. To rotate in one apply, change a value in keepers and set create_before_destroy:

resource "authwise_scim_token" "directory" {
realm_id = authwise_realm.staff.realm_id
scim_connection_id = authwise_scim_connection.directory.scim_connection_id
keepers = { rotation = "2" }
lifecycle {
create_before_destroy = true
}
}

A revoked or expired token is refused from then on. A lost token can’t be recovered: make another and revoke the lost one.

To pause a directory without losing its tokens, turn the connection off. On the connection’s page, click Turn off. Every request is refused with 401 until you click Turn on.

Terminal window
awctl identity scim-connections update SCIM_CONNECTION_ID \
--tenant-id TENANT_ID --realm-id REALM_ID --status disabled

Deleting a connection stops the directory’s pushes. It removes no users and no groups. Those users and groups then belong to no connection, and the next connection that writes one takes it.

  1. Request the connection’s discovery document with the token:

    Terminal window
    curl -H "Authorization: Bearer $(cat scim.token)" \
    https://login.example.com/scim/SCIM_CONNECTION_ID/v2/ServiceProviderConfig

    A 200 response with a JSON document means the base URL, the token, and the connection agree. A 401 means one of them is wrong.

  2. Run the directory’s connection test. A directory typically searches for a user that doesn’t exist and expects an empty list.

  3. Provision one person from the directory, and then find them on the realm’s Users tab. The user’s page shows the directory’s externalId.

  4. On the connection’s page, check the token’s row. It shows when the token was last used, which is updated at most once a minute.

  5. If the connection names a sign-in method, sign in as that person through it.

Every error is a SCIM error document with content type application/scim+json. Its detail says what was refused.

SymptomCauseFix
The connection has no base URL.The connection’s issuer has no host.Bind the issuer to a domain. See Domains and issuers.
Creating the connection is refused: the issuer doesn’t select the realm.The issuer doesn’t route to the connection’s realm.Choose an issuer that routes to the realm, or add the realm to the issuer’s routing.
Creating the connection is refused: the provider has no upstream identity.The sign-in method is a password or another local method.Choose a federated sign-in method, or none.
Every request returns 401.The token is wrong, expired, or revoked. Or the token belongs to another connection, the connection is turned off, or the base URL names another connection or another issuer’s host. Authwise gives the same answer in every case and records a token.rejected event.Copy the base URL from the connection again. Make a new token. Check that the connection is turned on.
Reads work, and creating a user returns 403: the realm doesn’t take SCIM provisioning.The realm’s SCIM channel is closed.Let the realm accept SCIM.
Creating a user returns 403 with a message about a limit.The tenant is at its plan’s limit for members.Remove unused accounts, or add seats to the tenant’s plan.
A change or a delete returns 403: managed by another SCIM connection.Another connection of the realm owns the user or group.Make the change from the owning directory.
409 with uniqueness.Another user holds the userName, the externalId, or the sign-in identifier, or another group holds the displayName or the externalId.Have the directory match the existing account instead of creating one, or fix the duplicate value.
400: this server doesn’t accept passwords.The directory sends a password.Turn off password synchronization for the application in the directory.
400: the connection identifies users by an attribute that the request doesn’t carry.The attribute in Identifier from isn’t mapped in the directory.Map the attribute, or choose another in Identifier from.
400 with invalidFilter.The directory’s matching uses an attribute or an operator that isn’t supported.Match on userName or externalId.
400: a member isn’t a user of this realm.The directory sent a member that it hasn’t pushed as a user.Assign the people to the application so that the directory pushes them first.
400: a user is already in 200 groups.The membership change would take the person past 200 groups.Push fewer groups for that person.
429.More than 1,200 requests in a minute for one connection from one address.The directory retries by itself. If it persists, lower the directory’s request rate.
404 or 405 with a valid token.The base URL in the directory is wrong, for example it lacks /v2.Copy the base URL from the connection again.
501.The directory calls /Bulk, /Me, or /.search.Turn off bulk operations in the directory.
A pushed person signs in and gets a second account, or is refused.The sign-in method asserts an identifier that differs from the attribute in Identifier from.Choose the attribute whose value equals what the sign-in method asserts. To admit only pushed people, keep just-in-time federation closed on the realm’s Sign-up tab.