Move between local accounts and SSO
This runbook moves an organization's members from local accounts to the organization's OIDC or SAML connection, and back. Each member keeps one canonical user ID. Memberships, roles, permission grants, and application data that reference that ID stay as they are.
The runtime never links identities because two email addresses match. A link needs proof from both sides: the member signs in with both methods, or an operator supplies a reviewed mapping.
compose.yaml with deployments/compose.migration.yaml runs a demonstration with Keycloak, and npm run test:e2e:migration drives it in a browser.
Before you start
Configure the organization's OIDC connection, or its SAML connection through administration. Confirm that a test account can sign in through it.
Decide which members keep a local password for recovery. With
recovery_only, only active owners whose membership no directory manages may still use one.Read the current state:
curl -H "Authorization: Bearer $SERVICE_KEY" \ https://enterprise.example.com/v1/organizations/org_example/identity-migrationThe response counts members, members with a local account, and members linked to the customer connection, and includes the login policy. The administration portal's Sign-in policy page shows the same numbers.
Take a database backup.
Option 1: members link their own identity
Each member opens Account security in the application, confirms their password, and selects Link for the organization's connection. The identity provider asks for a new sign-in. The callback must arrive in the same browser that holds the account-page session, so a link cannot be completed in someone else's browser.
The runtime rejects a link when the identity already belongs to another user, and records each link in the audit log. Members with a confirmed address get an email about the new sign-in method.
Watch members_linked_to_customer_connection grow until it matches members.
Option 2: an operator links in bulk
Use a bulk migration when the directory or identity provider already tells you which subject belongs to which user.
Write a mapping file:
{ "organization_id": "org_example", "connection_id": "customer-oidc", "source": "CHG-1042 export from the corporate directory", "mappings": [ { "user_id": "usr_8b1f", "subject": "00u1a2b3c4" }, { "user_id": "usr_93c0", "subject": "00u5d6e7f8", "directory_subject": "8f2c" } ] }subjectis the verifiedsubthe connection returns. Adddirectory_subjectwhen SCIM provisions the organization through that connection.Plan it:
enterprise-runtime identity-migration <config> plan --file mapping.jsonPlanning is a dry run that links nothing. It rejects a file that maps two users to one subject or one user to two subjects. Each item gets a predicted outcome; an item is a
conflictwhen the subject already belongs to another user, or when the user belongs to another organization and you did not pass--allow-shared-users. Planning the same file with the same shared-user setting returns the current plan. After rollback it creates a new plan.Review the conflicts. Resolve them in the identity provider or remove them from the file, then plan again. Planning, running or rolling back a job with
--allow-shared-usersneeds bothaccounts:manageandidentities:migrate, because the link also changes how that user signs in to their other organizations.Run it:
enterprise-runtime identity-migration <config> run --id <migration id>Items run in order, and each link commits with its progress. If the run stops, run it again: finished items stay as they are, and an item whose link committed before its progress was recorded becomes
already_linked. The migration ends ascompletedorcompleted_with_conflicts.Check progress with
identity-migration <config> status --id <migration id>.
The HTTP API under /v1/operator/identity-migrations does the same with an operator credential that has identities:migrate.
Service credentials and organization administrators cannot run bulk migrations.
Enforce SSO
Turn off local passwords once the members you need have linked:
curl -X PUT -H "Authorization: Bearer $SERVICE_KEY" -H "Content-Type: application/json" \
-d '{"local_login": "disabled", "require_mfa": false, "expected_version": 3}' \
https://enterprise.example.com/v1/organizations/org_example/login-policyUse recovery_only to keep recovery owners on local passwords.
The change needs sso:write and fails with a conflict if someone changed the policy since you read expected_version.
The change takes effect at once. New local sign-ins for the organization fail, pending local exchanges are refused, and existing local-origin sessions stop working on their next request. Members who linked sign in through the connection as the same user. Members who did not link lose access until they link or an operator migrates them.
Local accounts are not deleted. A member of another organization that still allows local passwords keeps local access there.
With the administration capability, enforce_sso in the organization's configuration has the same effect for every non-customer connection.
Local login then works only when the tenant's recovery_connection_id is the local connection, and only for recovery owners.
Return to local passwords
Set
local_loginback toenabledwith the current version.Members who have a local password sign in with it again.
Members who never had one sign in through SSO, open Account security, and use Add password sign-in. This adds a local account to the same canonical user. For a member who has a local password but lost it, an operator issues a recovery link:
enterprise-runtime account <config> recover --user usr_8b1f --send-emailaccount disable-localandenable-localturn one member's local password off and on without changing the organization policy.Members can remove the SSO link from Account security. The runtime refuses to remove a member's last sign-in method.
Roll back
Restore the organization's previous login policy and confirm the affected members can use another sign-in method. Then roll back the completed job.
enterprise-runtime identity-migration <config> rollback --id <migration id>The corresponding HTTP operation is POST /v1/operator/identity-migrations/{migration_id}/rollback.
It retires the sign-in links installed by this job and invalidates sessions and pending login codes from those links.
An item marked already_linked belonged to the user before the job and keeps its link. An item marked link_changed was replaced after the job and keeps its current link.
Rollback checks whether each member has another sign-in method that the target organization routes and its current policy permits. A shared-account job also checks each active membership that uses the retiring connection.
For a SCIM connection, the alternative identity needs a matching active directory assignment. A local password counts when the organization permits it for that member and the member can complete sign-in. A member can enroll a required second factor during tenant-specific sign-in. An already locked factor requires recovery first.
If removing a link would take away someone's last usable sign-in, rollback returns a conflict and leaves the entire job in place. A tenant-only job also returns a conflict if one of its affected users subsequently joined another organization.
On success, the job and its retired items report rolled_back. Retrying returns that stored result. The organization's audit log records the operator who performed the rollback.
Troubleshooting
| Symptom | Cause |
|---|---|
| "That identity can't be linked because it conflicts with another account." | The identity already belongs to another canonical user. Find it with account show and resolve it by hand. |
| A member sees "You can't continue" at local sign-in | The organization's policy no longer allows local passwords for them. |
members_linked_to_customer_connection stays at 0 |
The organization has no single customer connection: configure an administration tenant, or exactly one OIDC connection for the organization. |
A planned item stays conflict after a fix |
Plans are immutable. Plan the corrected file again; it gets a new ID. |