RealmDeployDocs
Migration

Moving from Azure AD B2C

List users from Azure AD B2C or Entra External ID with Microsoft Graph, convert them for Keycloak, and re-create apps and user flows. Local accounts set a new password by email link.

Passwords do not move. Microsoft Graph never returns a password and there is no hash export. Local accounts set a new password by email link after the move. The same applies to Microsoft Entra External ID.

1. Export users

List users with Microsoft Graph. Select identities and each extension attribute by name, because they are not returned by default:

GET https://graph.microsoft.com/v1.0/users?$select=id,displayName,givenName,surname,mail,otherMails,identities,accountEnabled,createdDateTime,extension_<app-id>_<name>&$top=999

Follow @odata.nextLink until it is gone and put every page's users into one value array. For groups, expand memberOf.

2. Convert

Open the Azure AD B2C to Keycloak users converter. It writes:

  • the sign-in email (or mail) as email and, by default, the username; a userName identity as the username if you choose it
  • givenName, surname, accountEnabled, createdDateTime
  • extension_<app id>_<name> as the <name> attribute, and id as b2c_object_id
  • groups from memberOf
  • UPDATE_PASSWORD for local accounts; federated identities get none

Graph has no per-user verified flag, so emailVerified is false unless you tick the option.

3. Re-create the rest

In B2CIn Keycloak
App registrationClient with the same redirect URIs
User flowsRealm login settings, registration and authentication flows
Custom policiesFlows, mappers or application code; REST calls in policies have no direct counterpart
Social and enterprise identity providersIdentity providers; register the new redirect URI
MFA (TOTP, SMS, email)Users enroll again; Graph returns TOTP secrets as null

Apps keyed on the object id (oid) see a new subject in Keycloak tokens: map b2c_object_id into the token.

4. Dry run, then cut over

Import into a staging realm with partial import and sign in through each app. At cut-over, stop sign-ups, export again, import, switch the apps and send the set-password emails in batches. Keep the tenant unchanged until you sign the move off.

The Azure AD B2C migration page covers what each plan includes.

On this page