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.
Before you begin
Section titled “Before you begin”- Identity server 1.92 or later.
- The console at 0.55 or later,
awctl0.45 or later, or Terraform provider 0.35 or later. - A tenant administrator seat, or a service account holding
tenant.adminoridentity.admin. With home administration, the roles areadministration.adminandadministration.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.
How a pushed user signs in
Section titled “How a pushed user signs in”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.
Let the realm accept SCIM
Section titled “Let the realm accept SCIM”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.
- In the console, open the realm and go to the Sign-up tab.
- Turn on A directory pushes them (SCIM).
- Save the change.
With awctl, set provisioning.scim to true in the realm’s
configuration:
awctl identity realms edit REALM_ID --tenant-id TENANT_IDReplace 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}Create a SCIM connection
Section titled “Create a SCIM connection”- In the console, open the realm and go to the SCIM tab.
- Click New SCIM connection.
- In Name, enter a name for the directory, for example
Entra ID. - In Issuer, select the issuer whose host serves the connection. Only issuers that route to this realm are offered.
- Optional: in Sign-in method, select the federated sign-in method the pushed people sign in through.
- In Identifier from, select the SCIM attribute that becomes each person’s identifier under the sign-in method.
- In When the directory deletes a person, select Turn the account off or Delete the account.
- Click Create connection. The connection’s page opens and shows its SCIM base URL.
With awctl:
awctl identity scim-connections create \ --tenant-id TENANT_ID --realm-id REALM_ID \ --display-name "Entra ID" \ --issuer-id ISSUER_ID \ --provider-id PROVIDER_IDawctl identity scim-connections describe SCIM_CONNECTION_ID \ --tenant-id TENANT_ID --realm-id REALM_IDReplace the following:
TENANT_IDandREALM_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 thatcreateprints, which starts withsc-.
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}Connection settings
Section titled “Connection settings”| Console | awctl flag | Terraform attribute | Meaning |
|---|---|---|---|
| Name | --display-name | display_name | A name for the directory. Required. |
| Issuer | --issuer-id | issuer_id | The issuer whose host serves the base URL. Required. It must route to the connection’s realm. |
| Sign-in method | --provider-id | provider_id | Optional. A federated sign-in method of the realm. Each pushed user gets an identifier under it. |
| Identifier from | --identifier-attribute | identifier_attribute | The 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-delete | on_delete | deactivate (the default) turns the account off. delete deletes it. |
| Turn off and Turn on | --status | status | active (the default) or disabled. A disabled connection refuses every request and keeps its tokens. |
Create a token
Section titled “Create a token”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.
- On the connection’s page, in Tokens, click Make a token.
- In Expires, select when the token stops working: Never, In 30 days, In 90 days, In a year, or On a date….
- Click Make token.
- Click Copy, and store the token where the directory’s setup can use it.
- Click I have copied it.
With awctl:
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}Configure the directory
Section titled “Configure the directory”Give the directory these two values:
| Value | Where it comes from | Common names in a directory |
|---|---|---|
| The base URL | SCIM base URL on the connection’s page, base_url from awctl identity scim-connections describe, or the base_url attribute in Terraform | Tenant URL, SCIM connector base URL |
| The token | The token you created | Secret token, API token, bearer token |
The base URL has this form:
https://login.example.com/scim/SCIM_CONNECTION_ID/v2The 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
externalIdto the directory’s own ID for the person or group, so that a rename in the directory doesn’t break the match.
Attribute mapping
Section titled “Attribute mapping”| SCIM attribute | In Authwise |
|---|---|
id | The user’s ID, assigned by Authwise. |
userName | The user name (the preferred_username claim). Required. Unique in the realm, without regard to case. |
externalId | The user’s external ID. Unique in the realm. |
name.givenName, name.familyName, name.middleName | Given, family, and middle name. |
displayName | Display name. When it’s absent, name.formatted is used. |
nickName | Nickname. |
profileUrl | Profile URL. |
photos | The primary photo, or else the first, becomes the picture. |
preferredLanguage, locale | Locale. preferredLanguage wins when both are sent. |
timezone | Time zone. |
active | true turns the account on, and false turns it off. When it’s absent, the account keeps its state. |
emails, phoneNumbers | Stored 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, x509Certificates | Stored and returned as sent. Authwise doesn’t interpret them. |
Enterprise extension (employeeNumber, department, manager, and the rest) | Stored and returned as sent. |
| Other extension schemas | Stored and returned as sent, under the schema’s URN. |
password | Refused with 400. |
groups | Read-only. Change membership on the group. |
Groups
Section titled “Groups”| SCIM attribute | In Authwise |
|---|---|
id | The group’s ID, assigned by Authwise. |
displayName | The group’s display name. Required. Unique in the realm. |
externalId | The group’s external ID. Unique in the realm. |
members | The 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.
What the directory can and can’t do
Section titled “What the directory can and can’t do”- Supported: create, read, replace (
PUT), patch, and delete for users and groups, and the discovery documents/ServiceProviderConfig,/Schemas, and/ResourceTypes. - Filters:
eqonuserName,externalId,id,active, and email address for users, and ondisplayName,externalId, andidfor groups.coandswwork onuserNameanddisplayName. Terms combine withandonly. - Paging:
startIndexandcount, with at most 200 results in a page. - Not supported: bulk operations, sorting, ETags, password change,
/Me, and/.search.
Accounts that already exist
Section titled “Accounts that already exist”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 sends | Result |
|---|---|
active: false | The 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: true | The 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 group | The 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.
Rotate or revoke a token
Section titled “Rotate or revoke a token”A connection can hold several working tokens, so you can rotate without a gap. A token can’t be changed after it’s made.
- Create a second token for the connection.
- Put the new token in the directory, and confirm that the directory still connects.
- 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:
awctl identity scim-tokens list --tenant-id TENANT_ID --realm-id REALM_IDawctl identity scim-tokens delete SCIM_TOKEN_ID \ --tenant-id TENANT_ID --realm-id REALM_IDSCIM_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.
Turn off or delete a connection
Section titled “Turn off or delete a connection”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.
awctl identity scim-connections update SCIM_CONNECTION_ID \ --tenant-id TENANT_ID --realm-id REALM_ID --status disabledDeleting 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.
Check that it works
Section titled “Check that it works”-
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/ServiceProviderConfigA
200response with a JSON document means the base URL, the token, and the connection agree. A401means one of them is wrong. -
Run the directory’s connection test. A directory typically searches for a user that doesn’t exist and expects an empty list.
-
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. -
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.
-
If the connection names a sign-in method, sign in as that person through it.
Troubleshooting
Section titled “Troubleshooting”Every error is a SCIM error document with content type
application/scim+json. Its detail says what was refused.
| Symptom | Cause | Fix |
|---|---|---|
| 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. |
What’s next
Section titled “What’s next”- Sign in through a SAML identity provider, for the sign-in method the pushed people use.
- Realms, for the other ways an account can come to exist.
- Route sign-ins by email domain, to send people to their directory from the sign-in page.