Consolidating multiple Keycloak instances or realms starts with knowing what you are merging
Consolidating Keycloak after a reorganization or acquisition is mainly a job of duplicate handling, secret re-entry and phased redirects, and the effort depends on how many realms, users and applications overlap between the estates. Before anyone exports anything, list every realm, every client, every identity provider and every user store on each side, and mark which items exist in both places. That inventory decides how much work the merge is, and it is the artifact to ask a partner to price against.
Do not treat the Admin Console partial export as a backup or a transfer path. According to the Keycloak import and export guide, it covers realm settings and resources such as clients, roles and groups, but it leaves out users, and it masks passwords and client secrets. It is also described as not suitable for backups or for moving data between servers. Users therefore need a full export, which the CLI produces with user data included, and the source estate should be retained as a rollback point until every application has moved. Confirm with your own environment whether your deployed version supports the export options you plan to use.
Treat the exported files as sensitive material, since they hold password hashes and identity data. Plan how each masked secret will be re-entered on the target, who holds the values, and where they will be stored. Confirm the target's administrators can approve these steps before the first import, because re-entered secrets are a common source of broken sign-in after cutover.
Which realm objects carry over cleanly and which need rework
This table compares each realm object type between a source and a target realm, showing what a partial export carries, what it leaves out and what needs a decision before merging. Read it as a checklist: objects marked for rework need an owner and a written choice before the import runs.
| Realm object | Partial export | Consolidation action |
|---|---|---|
| Realm settings | Included | Compare token lifetimes, password policy, login and email settings with the target, then pick one set of values per merged realm. |
| Clients | Included, secrets masked | Recreate or re-enter client secrets in the target. Confirm redirect URIs and web origins per application before cutover. |
| Roles and groups | Included | Check for name collisions with existing target roles and groups, and confirm composite role membership survived the import. |
| Users | Not included in partial export | Use a full export or a separate user migration. Passwords are not readable in exports, so plan a reset or a migration path. |
| Duplicate users and clients | Conflicts surface at import | Choose Fail, Skip or Overwrite per object type. Decide which account is the system of record for each person and each application. |
| Identity providers | Depends on export scope | Re-enter upstream client secrets and confirm callback URLs. Check mappers that depend on the old provider alias. |
| Authentication flows | Included as definitions | Review custom flows and required actions against the target's MFA policy. Test each flow before users reach it. |
| Custom SPI providers and themes | Not covered by export | Check each provider and theme separately against the target Keycloak version. Rebuild and retest them, because export does not carry them. |
Documented export and import paths for realm consolidation
Keycloak documents several ways to move realm data between instances, and each one carries different content and conflict behavior. The cards below cover the Admin Console paths, the server-side import switches and the checks to run before a consolidation starts. Confirm each step against the version you run, because the exact menus and flags are defined in the official guide.
Admin Console partial export
A partial export from the Admin Console covers realm settings and resources such as clients, roles and groups, but it leaves out users. It also masks passwords and client secrets, so the output cannot restore a realm or carry credentials to another server. Use it to copy configuration for review or to rebuild resources by hand, and plan separately for secrets and users. Confirm in your version whether any resource type you depend on is missing from the file.
Keycloak import and export guidePartial import conflict handling
When the Admin Console imports a partial file and a resource already exists, you choose Fail, Skip or Overwrite. Fail stops the import, Skip keeps the target's version, and Overwrite replaces it. In a merge, the choice decides whether clients or roles from the acquired business silently replace production settings. Run the import against a copy first and review every conflict the import reports.
Keycloak import and export guideFull export with users
A full export from the command line includes users, which makes it the path for moving a whole realm, including accounts. Because the export is produced by the server tooling rather than the Admin Console, confirm the exact command and output options for your release in the official guide. Full CLI exports can be imported through the Admin Console, so check that the file loads cleanly before you plan a cutover. Treat the file as sensitive personal data and control where it is stored.
Keycloak import and export guideServer-side import with override
Importing with override replaces existing realm data on the server, and the guide requires all Keycloak nodes to be stopped first. Running it against a live cluster risks inconsistent sessions and partial writes. Schedule a maintenance window, stop every node, run the import and confirm the realm state before you restart. Rehearse the sequence on a non-production copy so the window length is known.
Keycloak import and export guideSkipping existing realms with override false
Setting --override false tells the server import to skip any realm that already exists, so the import adds new realms and leaves current ones untouched. This is the safer choice when you bring in a realm from another instance that must not disturb a realm already in production. The skipped realms are not merged, so check the target for realm names that collide before you run the import. Confirm the flag behavior in the version you operate.
Pre-consolidation version check
Export and import formats can change between releases, so the source and target should run the same Keycloak version or a version the guide supports for that move. The current release is 26.8.1, but your source may be older, which makes a version check the first task. Record the source version, the target version and the export format used. Ask your vendor or partner to confirm compatibility in writing before the first trial import.
Full export versus partial export for merging realms
Choose the export method before anything else, because it decides what can move at all. The Admin Console partial export covers realm settings and resources such as clients, roles and groups, but it leaves out users and masks passwords and client secrets. The Keycloak import and export guide also describes it as unsuitable for backups or transfer between servers. A merge that depends on a partial export therefore moves configuration only. Every user must come from a full CLI export that includes users, and the first decision is whether your target realm needs those accounts at all or can rely on identity brokering to a source directory. If the accounts must move, plan a full export from each source realm and treat the exported user records as the authoritative identity data for the merge.
Masked secrets turn every confidential client into a manual task. A partial export shows placeholders where client secrets should be, so the target client cannot authenticate until someone issues a new secret or enters the real value. Record each confidential client in an inventory with its owning application team, its redirect URIs and the rotation window agreed with that team. Use the target's own secret generation rather than copying values between environments, and schedule cutover so each application receives its new secret before its old one stops working. Stored user passwords are a related question: a full export carries password hashes, so confirm the hash algorithm and realm password policy on the target before assuming existing logins will work unchanged.
Duplicate identifiers are the conflict that most often breaks a merge. Usernames, email addresses and client IDs are unique within a realm but not across realms, so the same person or application can appear in two sources with different attributes. Decide one rule per identifier before importing. For example, an email address may map to a single user only if it has been verified in both sources, and a client ID collision should be resolved by renaming one client and updating its redirect URIs, not by overwriting. The Admin Console offers Fail, Skip or Overwrite when resources already exist, and the --override false option skips realms that already exist. Overwrite is the riskiest choice for users and clients because it replaces records that applications may already depend on. Identity provider links and group membership need reconciliation after import: confirm that each linked provider alias exists in the target, and that group paths and role mappings still describe the access model the owners approved.
How a multi-realm merge moves from inventory to decommission
This sequence takes separate Keycloak realms or instances from a documented inventory to a single target that has been tested, piloted, cut over and verified, with the old sources retired only after logins and tokens check out. The order matters because each step produces the evidence the next one depends on. The exact sequence and timeline depend on your environment and must be confirmed in the written scope.
Inventory realms, clients, users and secrets
Record every source realm or instance with its realm settings, clients, roles, groups, identity providers, user federation links, authentication flows and custom providers. Note which users exist, which clients hold secrets and which applications redirect to each source. The platform team and application owners do this together, because the application list is often incomplete. The step is done when each source has a written inventory that the owners have reviewed and signed off.
Build the decision log for duplicates
Compare the inventories and list every collision: the same username or email in two sources, clients with the same client ID, roles or groups with matching names but different meaning, and identity providers configured twice. For each item, record the chosen outcome, the owner who approved it and the reason. Duplicate users need a rule for which account wins and how linked identities are kept. The step is done when every collision has a logged decision and no open items remain without an owner.
Test the import in a non-production target
Export each source with the server CLI, which includes users, and import the files into a non-production Keycloak using the decision log as the guide. The Admin Console partial export is not suitable for this, because it leaves out users and masks passwords and client secrets. Confirm that secrets are re-entered or rotated where masking applies, and that the Fail, Skip or Overwrite choice matches each decision. The step is done when the test target shows the expected users, clients and roles, and the import log has no unexplained errors.
Pilot one application wave
Choose one low-risk application and point it at the merged realm in the test environment. Check sign-in, token claims, role mapping, logout and refresh behavior with its real client configuration. Include a user who came from each source realm, since their accounts may differ in attributes or linked identity providers. The step is done when the application owner confirms the flows work and the issues found are fixed and retested.
Run both sources in parallel
Keep the old realms live while the target runs in production-like conditions for the first wave. Monitor sign-in errors, token issuance and support tickets, and compare user counts and login records between source and target. Confirm that the team knows which system holds the authoritative copy of each user during this period, and that password changes and profile edits are handled in one place. The step is done when the comparison shows no unexplained differences and the owners accept the target for the first wave.
Cut over with a stopped server when overriding
If the final import uses override, stop all Keycloak nodes first, because the documentation requires it, then run the import with the agreed settings and start the target. Use a freeze on user and client changes in the sources for the window, and take a backup of each source before stopping it. Verify the cutover with the same checks used in the pilot. The step is done when the target serves the first wave, the import log is archived and the rollback path has been confirmed as still usable.
Redirect applications in waves
Move the remaining applications to the target one group at a time, updating redirect URIs, issuer settings, client secrets and logout URLs in each application and in the merged realm. Keep each wave small enough that its owner can verify it before the next one starts. Record which applications have moved and which still depend on the old sources. The step is done when every application has a confirmed cutover entry and no application still points at a source realm.
Decommission the old realms after verification
Retire each source realm only after logins, token refresh, logout and administrative access have been verified against the target for all waves, and after the audit and retention requirements for old logs and exports have been confirmed with your compliance team. Remove or disable the old instances, rotate any secrets that were copied into exports and revoke the export files from storage they should not be in. The step is done when the decommission record names each retired source, the checks it passed and where the retained evidence is kept.
How applications move to the merged realm in waves
The flow starts with source realms exported from each Keycloak instance, with users handled separately because partial export leaves them out. Conflicts such as duplicate users and clients are resolved before import into one target realm. A pilot wave moves a low-risk application first, then further waves follow, while source and target stay live in parallel until each wave is verified. Decommissioning a source realm happens only after its last application has been redirected and checked.
Source realms merge into one target and applications move in verified waves.
What drives the cost and duration of a consolidation
This table lists the factors that change the effort of merging Keycloak instances or realms, whether each one is paid once or recurs, and what to request in a written quote. Use it to compare your current estate against each driver before you ask for a scope. The main takeaway is that realm count, overlapping users and the number of application owners usually shape the effort more than the export itself.
| Driver | Why it changes cost or effort | One-time or recurring, and what to ask for in a quote |
|---|---|---|
| Number of source realms and deployments | Each realm or server needs its own export, mapping, conflict review and test pass. Separate Keycloak versions add upgrade steps before any merge. | One-time. Ask for a per-source inventory of realms, versions and databases, and whether upgrades are in or out of scope. |
| User volume and overlap | Duplicate accounts across sources need matching rules, a decision on which identity wins, and checks on email and username collisions. Full CLI exports include users, partial exports do not. | One-time. Ask how duplicates are matched, who decides the winner, and how password handling is treated for each source. |
| Number of clients and redirect URIs | Every client needs a rename or ID check, secret handling, and an updated redirect list. Wildcard or shared redirect URIs take longer to verify. | One-time. Ask for a client count by source and a list of redirect URIs that must be validated before cutover. |
| Custom providers and themes | Custom SPI providers, authenticators and themes must be rebuilt, tested and redeployed against the target version, and may not carry over unchanged. | One-time for the rebuild, recurring for each later upgrade. Ask whether each provider is kept, rewritten or retired. |
| Federated identity providers and user federation | LDAP, Active Directory, Kerberos and brokered providers need mapper review, connection checks and a plan for which source is authoritative. | One-time for setup, recurring for connectivity and sync checks. Ask for each federation link and its owner. |
| Database platform differences | Moving between database engines changes the cutover plan and may add a database migration step. Import with override requires all nodes stopped. | One-time. Ask which database engines are in use, the target platform, and the planned outage window for the final import. |
| Regulatory evidence needs | Access reviews, change records, data transfer assessments and retention proof add documentation and sign-off work. Some frameworks also require a documented exit or transition plan for critical services. | One-time for the evidence pack, recurring if the consolidated estate is reviewed each cycle. Ask which frameworks apply and what evidence format each assessor expects. |
| Number of application owners to coordinate | Each owner must approve redirect changes, test sign-in and logout, and agree on a wave date. Coordination time often grows faster than technical work. | One-time for the migration waves. Ask who signs off each wave, the test window per application, and the rollback owner. |
What usually goes wrong when realms are merged
Most realm merges fail at the seams: identities that exist twice, credentials that change without the apps knowing, and cutover steps done out of order. Each card below names one failure, why it hits a consolidation specifically, and the prevention step to build into the plan before the first import.
Duplicate users lock out staff
The same person often exists in both source realms under different usernames, or the same email appears twice in the target. Importing without a matching step can create a second account that receives none of the old roles, groups or credentials, so the employee signs in and finds access missing. Before import, list every email address and username that appears in more than one source, decide which account is authoritative, and map the others to it. Check that the target enforces unique email addresses before you run the import.
Import and export guideClient secrets must be re-issued
Partial exports mask passwords and client secrets, so an imported confidential client arrives without a usable secret. Every application that authenticates with that client will fail until someone generates a new secret in the target and deploys it to the application's configuration or vault. Inventory each confidential client, assign an owner for the secret rotation, and schedule the redeploy in the same wave as the client's redirect change. Do not treat the masked value as a value to copy.
Redirect URI mismatches break waves
Each client in the target only accepts the redirect URIs and web origins listed on it. When an application moves to the consolidated realm in a wave, a missing or slightly different callback URL returns an error at login, and the failure often appears only in one browser flow or environment. Compare the exact redirect URIs, post-logout URIs and web origins between source and target for each client, including trailing slashes and staging hostnames. Test the sign-in path in every environment before moving the next wave.
Federated identity links go missing
Users who signed in through an upstream provider, such as a social login or a corporate identity provider, are linked to that provider by an identifier stored in the source realm. If the upstream provider is not configured in the target, or the link does not transfer, those users cannot sign in with their usual method and may create a new local account on first attempt. Record each identity provider and its mappers, configure them in the target before cutover, and test one brokered login per provider.
Expected users are skipped
A partial import with Skip keeps the existing record whenever a resource already exists, so users that differ only slightly from a target record can silently stay out of the target. Teams then discover on cutover day that some accounts were never migrated. Reconcile user counts and a sample of identifiers between source and target after each import, and review the list of skipped resources before you treat a wave as complete.
Override mode left on a live cluster
Importing with override replaces existing resources, and the documented procedure requires all Keycloak nodes to be stopped first. Running the import while one node still serves traffic, or leaving a server in override mode after the work is done, risks overwriting live configuration or leaving the cluster in an inconsistent state. Plan a maintenance window, stop every node, run the import with the override setting explicitly chosen, verify the realm, then restart and remove the override setting from later runs. Keep a full export taken before the import so you can restore the prior state.
Questions buyers ask before consolidating Keycloak realms
How much effort does merging Keycloak realms take, and what drives it?
Effort depends mostly on how many clients, identity providers, roles, groups and user records overlap between the sources, and on how many applications must be redirected. A merge with few overlapping clients and one shared identity provider is far smaller than one where two realms define the same client IDs with different redirect URIs and token settings. Each conflict needs a decision: keep one definition, rename, or retire. Ask for an inventory of every realm, client, identity provider, custom provider and theme in each source before agreeing a scope. The inventory is the input that makes any quote comparable.
Can our own team consolidate Keycloak instances without outside help?
A team that already runs Keycloak in production and has tested exports and imports in a non-production copy can usually do the technical merge itself. The harder parts are often the decisions about naming, ownership and token behavior, and the coordination with application teams. Teams with no recent Keycloak administration experience, or with custom providers that must be rebuilt, should weigh a fixed-scope engagement against their own staffing. DeployOpen plans, implements and documents this work in the client's infrastructure under a written scope. Confirm which of these skills your team already has before deciding.
What does the merge need from our staff and application owners?
The merge needs a named owner for the target realm, a representative from each source realm who can confirm its clients and users, and an owner for every application that will be redirected. Application owners must confirm redirect URIs, logout behavior, token claims and any service accounts, and they must schedule a test window. Security and compliance staff should review the access model and the admin accounts that will exist after the merge. Ask the consultant for a RACI or equivalent list so each decision has one accountable person.
How long should the parallel run last after consolidation?
The parallel run length depends on your environment, not on a fixed number. It should last until every application in the first wave has completed sign-in, token refresh and logout against the new realm, and until any scheduled jobs, service accounts and integrations have been checked. Factors include how many applications use long-lived sessions, how many depend on refresh tokens, whether external partners hold configured redirect URIs, and how quickly your change process can roll back. Agree exit criteria for each wave in writing, and confirm the rollback path with the application owners before the first cutover.
Can a partial export replace a full backup before consolidating?
No. The Admin Console partial export covers realm settings and resources such as clients, roles and groups, but it does not include users. It also masks passwords and client secrets, and the Keycloak documentation describes it as not suitable for backups or transfer between servers. Before any merge, take a full backup of the database and a full realm export from the CLI that includes users, and store it according to your retention policy. Test restoring that backup in a non-production environment. Partial exports remain useful for reviewing configuration, but they are not a recovery point.
How do we handle users who exist in more than one source realm?
Start by deciding the identity of each person: whether the same email address, username or upstream identity should map to one user in the target realm. Partial import offers Fail, Skip or Overwrite when a resource already exists, and each choice has different consequences for passwords, roles and group memberships. Overwrite is risky when two records belong to different people with the same username. Plan a matching rule, run it against a copy of the data, and review the list of collisions with the business owners. Confirm how credentials and MFA enrollments will be carried over, since some may need to be re-enrolled.
Does consolidation affect our compliance evidence or access reviews?
It can. Consolidation changes which realm holds each application, admin role and user record, so access reviews and configuration evidence from before the merge may no longer match the target. Keep the pre-merge exports, the collision decisions and the cutover records as change evidence. Where your framework requires documented controls over identity and access, have your compliance team confirm how the new realms map to those controls. DeployOpen prepares systems, controls and evidence for compliance assessments, but independent auditors and certification bodies issue any audit report or certification.
Which parts of the Keycloak configuration are hardest to move?
The hardest parts are usually secrets, custom providers and token-dependent integrations. Exported secrets are masked, so client secrets and identity provider credentials must be re-entered or retrieved from your secret store before the target works. Custom SPI providers and themes must be built against the target version. Applications that rely on specific token claims, audiences or issuer URLs need testing, because a new realm changes the issuer. Ask whether each of these has been inventoried, and confirm how secrets will be supplied to the target without being written to a shared document.
What regulated organizations must evidence during a merger
Consolidating identity systems after an acquisition is an access control change, and regulated organizations usually have to show who approved it, what changed and who could reach what during the transition. Keep a dated record of every realm, client, role and group that moved, the export files used, the import mode chosen for each wave and the person who signed off on each conflict resolution. For public companies, the SEC's guidance on internal control over financial reporting lets management exclude a newly acquired business from its assessment for a limited period, but the exclusion, the business excluded and its significance must be disclosed. Ask your auditors and counsel which of your Keycloak realms touch financial reporting, because that decides which IT general control areas, such as access to programs and data, need evidence for the merged environment.
Third-party oversight and data transfer rules can apply even when the consolidation is purely technical. If the acquired business sits under a different regulator or contract, confirm whether the new identity platform changes your register of ICT service arrangements, your third-party risk documentation or your incident notification duties. If EU personal data is involved, be aware that giving an acquirer's staff remote access to the target's Keycloak administration console or user records from outside the EEA can count as a transfer that needs a transfer tool under Chapter V of the GDPR. Records of processing and processor instructions should reflect the new flow before cutover, not after.
Where protected health information is involved, check that business associate terms cover the consolidated environment. A HIPAA business associate contract must require compliance with the Security Rule, flow those terms to subcontractors that handle ePHI and require reporting of security incidents. Confirm these obligations with counsel and your auditors. DeployOpen prepares the access listings, configuration exports, change logs and test records that those reviews request, but it does not issue audit reports, attestations or certifications. Those come from independent auditors and certification bodies, so agree the evidence list with them before the first wave moves.
How DeployOpen scopes and delivers a Keycloak consolidation
DeployOpen plans, builds, tests and documents Keycloak consolidations inside the client's own infrastructure, starting from a written scope that names every realm, client and user source in play. Work is fixed-scope, so the merge method, conflict rules and redirect waves are agreed before any data moves.
How we scope
- The written scope lists each source instance, realm, client and user population involved in the merge.
- We record which export type each source supports, since partial exports leave out users and mask secrets.
- The scope sets duplicate user and client rules, ownership of conflicts, and the application redirect waves.
How we build
- We build the target realm first, then rehearse imports on copies while the source instances keep running.
- Override imports are scheduled with all Keycloak nodes stopped, and the rehearsal sets that window.
- Secrets are re-entered or rotated after import, and each client is tested against its redirect wave before cutover.
How we hand over
- You receive the consolidation runbook, realm configuration, import logs and a mapping of old to new client IDs.
- Documentation records which applications moved in each wave, their redirect URIs and their rollback steps.
- Your team runs a handover session covering the import procedure, conflict decisions and post-merge checks.
How we support
- Ongoing support, upgrades and continuous testing are available as a retainer after the consolidation is complete.
- Retainers can cover decommissioning of retired instances and follow-up fixes for applications found late.
- Confirm response expectations and support hours in the written scope before work starts, since these are agreed per engagement.

