Keycloak 25 to 26 upgrade

A planning guide for moving a self-managed Keycloak from 25 to 26 with sessions intact, covering what changes, the database migration, the rollback points and what drives effort.

On this page

How to plan a Keycloak 25 to 26 upgrade without losing sessions

Plan a Keycloak 25 to 26 upgrade in three stages: enable persistent user sessions on the running 25 deployment first, then work through the 26 changes, then fix the rollback points before anything in production moves. Keycloak documents the supported path in its upgrading guide, and that guide is the reference for each change listed here. Treat the upgrade as a sequence of planned steps, each with its own test and exit criteria. This section covers what changes, what to prepare, the order of work, how to test, how to roll back and the factors that drive effort, so your team can decide whether to run it in-house or scope it with a partner.

Start with the persistent session change because it determines whether users stay signed in through the restarts that the 26 move requires. Confirm in the upgrading guide how the Protostream cache change affects your cache configuration and any code that reads Infinispan caches directly. Next, review hostname and proxy-headers against your reverse proxy. Hostname settings control the issuer and endpoint URLs in tokens and discovery documents, so a mismatch breaks sign-in for every application at once. Finally, take a restorable database backup and decide whether schema migration runs automatically at startup, the default, or manually from SQL that your DBA reviews. Record which rollback point you rely on: the binary, the database, or both.

Test on a copy of production that includes your real realms, clients, federation links and custom providers. Custom SPI providers and themes must be rebuilt and checked against the 26 release, and the test plan should cover login, MFA, token refresh, logout, the admin console and each integrated application. Effort depends mainly on the number of custom providers and themes, the number of clients and identity providers, database size, the high availability topology and whether a staging environment already exists. Ask any partner for a written scope that names the environments, test cases, rollback rehearsal and handover. Note that the one-time upgrade work differs from recurring costs such as patch cycles, which Keycloak releases four minor versions a year according to its project plan.

What changes between Keycloak 25 and 26 and what each change requires

This table lists the Keycloak 25 to 26 changes that affect an upgrade, with the impact of each and the action to take before or during the move. Read the 26 entries first for platform-wide changes, then the 26.8 entries if you are targeting the current release. Items marked to confirm need checking in the upgrading guide before you schedule the change.

ChangeImpactAction needed
Persistent sessions on Keycloak 25Sessions stored in the database let users stay signed in through restarts, which protects them during the move to 26.Enable persistent user sessions on 25 first, then confirm sessions survive a restart in staging.
Protostream cache changeChanges how the embedded cache stores and serializes data, which matters for clusters running mixed versions during a rolling change.Confirm in the upgrading guide whether 25 and 26 nodes can run side by side, and test session survival in staging.
Hostname v2 optionsHostname settings move to the v2 options, and a mismatch can produce wrong issuer URLs in discovery documents or redirect loops.Map existing hostname settings to v2 options and check the issuer value in the discovery document.
Proxy header handlingKeycloak must trust the forwarding headers your reverse proxy sends, or it builds incorrect public URLs.Confirm the proxy header setting for 26 in the guide and match it to your reverse proxy configuration.
Automatic schema migration at startupThe database schema migrates on first startup by default, so tables change before the server accepts traffic.Take a restorable database backup, choose automatic or manual migration, and confirm the timeout for your table sizes.
Opt-in breaking changes in minor releasesKeycloak says breaking changes in a minor release are opt-in, which lowers the chance of unplanned behavior changes between 26.x releases.Read the migration notes for each minor release you move through and enable opt-in changes deliberately.
SMTP StartTLS enforced (26.8)Plaintext fallback is removed, so mail fails if the relay does not offer StartTLS.Confirm your relay supports StartTLS, then test password reset and email verification.
Backchannel logout token signatures (26.8)Logout tokens from external providers must have valid signatures, so logout from those providers can fail.Confirm the trusted keys for each external provider and test backchannel logout end to end.
Login failures persisted by default (26.8)Failed login records are written to the database by default, adding write load and table growth.Size the database for the extra writes, set a retention plan, and confirm the setting in the 26.8 notes.

What to prepare before touching the 25 deployment

Before any Keycloak 25 node is changed, the team needs a restorable copy of the data, a complete list of what the deployment depends on, and a way to prove the upgraded system behaves like the old one. The six items below connect those needs, and each one should be finished and signed off before the upgrade window is scheduled.

Restorable database backup

Take a full database backup and test that it restores into a separate instance before anything else changes. Keycloak applies schema migrations automatically at startup by default, so a failed migration can leave the database in a state that only a backup can reverse. Record the backup identifier, the Keycloak version it was taken under, and the restore steps your team has rehearsed. Confirm with your database team whether a manual migration path is preferred for a database of your size.

Upgrading guide

Inventory of custom themes and providers

List every custom login theme, account theme, email template, SPI provider and extension jar running in the 25 deployment, with its source repository and the Keycloak APIs it calls. Custom code is the part of an upgrade most likely to fail at startup or at login, and it is rebuilt against the new release rather than copied across. Mark which items are vendor code, which are in-house, and which have no current owner.

Hostname and proxy configuration record

Export the current hostname, proxy and forwarded-header settings from every node, the load balancer and the reverse proxy, including which URLs are public and which are reserved for the admin console and Administration REST API. Keycloak 26 changes how hostname options and proxy headers are read, so a value that worked in 25 can produce wrong issuer URLs or redirects in 26. Keep this record as the baseline for comparing the new configuration.

Production-like test environment

Build a staging environment with the same Keycloak configuration, database engine and version, cache setup and reverse proxy as production, then restore a copy of the production database into it. Test sign-in, token refresh, logout, admin tasks and each custom provider there first. A staging environment with an empty database will not show schema or session problems, so the data copy is what makes the test meaningful.

Monitoring baselines from the metrics endpoint

Enable metrics on the management interface with --metrics-enabled=true in the 25 deployment before the upgrade, then capture normal values for login rates, failed logins, token request latency, database connection use and cache behavior over several business days. Without a baseline, the team cannot tell whether a slowdown after the upgrade is new or was already present. Store the captured values alongside the backup record so both are available during the change window.

Metrics guide

Named owner for approvals

Assign one person who can approve the change, hold the rollback decision and sign off the test results, with a deputy who can act when that person is unavailable. Name the owners of the database, the reverse proxy, the custom code and the application teams that depend on the realm, since each one may need to test or be on call. Write the approval criteria down before the window so the decision to continue or roll back is not made under pressure.

How to sequence the 25 to 26 upgrade with rollback points

This sequence moves a Keycloak 25 deployment to 26 in an order where each step has a check that confirms it and a clear point up to which the change can still be reversed. The schema change is the step that closes the easy rollback path, so everything before it is designed to be reversible.

  1. Enable persistent sessions on Keycloak 25

    Before anything else, turn on persistent user sessions while still running Keycloak 25, so that sessions are stored in the database and survive the restart and cache change that come with 26. Make this change in a test realm first, then in the production configuration through your deployment tooling. The step is done when a new login in each realm is visible as a persisted session in the admin console and survives a rolling restart of a single node on 25. Rollback here is a simple configuration revert, because nothing about the schema has changed yet.

  2. Verify session behavior under persistent sessions

    Confirm that sessions behave the same way they did before the change. Log in through a representative set of applications, refresh tokens, log out from one application and check single logout, and restart one node to confirm the session still resolves. Check the database for session rows and check that session expiry matches your configured lifetimes. The step closes when these checks pass in production-like conditions, and any failure is fixed on 25 where a revert is still low cost.

  3. Take a restorable database and configuration backup

    Take a full database backup and a copy of your Keycloak configuration, including realm exports, custom themes, provider JARs, the server configuration file and environment variables. Confirm that the backup restores into a separate database instance and that Keycloak 25 starts against the restored copy. This is the last point at which a schema change can be reversed by restoring data rather than by re-running migrations, so the step closes only when the restore test passes.

  4. Run the upgrade in a test environment

    Build a non-production environment with a copy of the production database, the same database engine and version, the same reverse proxy and the same custom providers. Start Keycloak 26 against that copy and read the upgrade notes for every 26 release between your current version and the target, including the Protostream cache change and hostname v2 settings. The step is done when the test environment starts cleanly, logins succeed for each application, and the upgrade is repeatable from the runbook.

  5. Migrate the schema automatically or manually

    Choose how the database schema changes. By default Keycloak migrates the schema automatically at startup, which suits smaller databases with a tested timing. For large databases, the upgrade guide describes applying the SQL yourself, so the DBA can review the statements, schedule them in a maintenance window and run them before starting 26 nodes. Confirm the choice in the test run, record the migration duration you observed, and keep the SQL scripts as evidence. This step is the rollback boundary: after the schema change, a return to 25 needs the pre-upgrade backup, not a configuration revert.

  6. Move hostname and proxy settings to version 26

    Translate the hostname and reverse proxy configuration to the 26 options, including the hostname v2 settings and the proxy headers your load balancer sends. Keep the admin console and Administration REST API on a separate hostname or context path from public frontend URLs, as the production guide recommends. The step is done when discovery documents return the expected issuer and endpoint URLs, admin access works only from the intended network, and redirect URIs in test clients resolve. Because these settings are configuration rather than data, they can still be reverted to the 25 values until the production rollout begins.

  7. Rebuild and test custom providers and themes

    Rebuild every custom SPI provider, login theme and email theme against the 26 libraries, then deploy them to the test environment. Run the login, password reset, account console, admin console, token issuance and any custom authenticator flows that your organization depends on. The step closes when every custom component loads without errors in the server log and each test flow completes, with failures recorded as blocking or deferred. Custom code that fails here should block the production rollout rather than being patched during it.

  8. Roll out to production with a defined rollback point

    Schedule the production change, reapply the verified configuration and schema, and roll nodes forward one at a time while watching health checks, login success and error logs. Define in advance the point of no return: before the schema migration, rollback means reverting configuration and redeploying 25 nodes; after it, rollback means restoring the pre-upgrade backup and accepting the loss of any changes made since. Ask your vendor or DBA to confirm the restore time against your database size, since that time sets how long a failed rollout can take to undo. The step closes when logins, token issuance and admin access are confirmed on all nodes.

How the Keycloak database schema migrates at startup and when to run it manually

Keycloak migrates its database schema automatically at startup by default, so a 25 to 26 upgrade can change tables the moment the new server starts against an existing database. Take a restorable database backup before the first 26 node starts, whichever migration path you choose. The backup is your only reliable rollback, because a schema that has been migrated forward is not expected to work with a 25 server again. Confirm the backup restores cleanly into a scratch database and that you can measure how long the restore takes.

The default path keeps the upgrade simple: the first 26 pod or process applies the changes while the others wait, and the cluster comes up without a separate SQL step. The cost is that migration time lands inside your maintenance window and is hard to predict on large tables. The upgrading guide, linked from this page, suggests manual migration for large deployments, where administrators generate the SQL, review it with the DBA, run it during a planned window and then start 26 with automatic migration disabled. Check the exact settings and migration flags for your database in the upgrading guide, because they depend on the version and database you run.

Choose manual migration when table sizes or the migration timeout make the startup path risky, or when change control requires reviewed DDL. Choose automatic migration when your database is small enough that a test run on a copy of production finishes well inside the window. In either case, rehearse the full upgrade against a restored copy, record the duration, and decide in advance who approves a rollback. For very large tables, see the sibling topic on database schema migration for large databases.

How the upgrade phases and rollback points fit together

The upgrade starts with an inventory of the running Keycloak 25 deployment and a switch to persistent user sessions while still on 25. A backup is taken before the test upgrade, and the test run proves the schema migration in a copy of production data. Rollback is only a clean option up to the point where the production schema migration starts, so that hand-off is the one to check most carefully. Provider tests run before the production rollout, and the configuration move is verified on the test copy.

Upgrade phases in order, with the rollback decision made before the schema migration.

How to test custom providers and roll back safely

Custom SPI providers, login themes and email templates are the most likely place for a 25 to 26 upgrade to fail after the server starts cleanly. Treat them as code that must be rebuilt and retested against the 26 server, not as files you copy across. Build each provider against the 26 dependencies, then run it in a staging realm that holds a copy of production configuration. Exercise every path the extension touches: login, registration, password reset, token issuance, user federation calls and any event listeners. Check the admin console and login theme output in a browser, not only in logs.

  • Rebuild every JAR: Compile providers against the 26 release so they do not carry 25 assumptions into production.
  • Test each extension path: Run login, token, logout and admin flows that call your code, and record the results per release.
  • Review theme overrides: Compare custom templates and resources with the 26 base theme to find markup or message keys that no longer match.
  • Confirm event listeners: Trigger the events your listeners consume and verify that the downstream systems receive them.
  • Rehearse the rollback: Restore a staging database from the pre-upgrade backup and confirm that the 25 build with its original providers starts.

Before approving the change, confirm the test plan against the upgrading guide so that no custom code path is left unexercised.

What makes a Keycloak 25 to 26 upgrade take longer

This table lists the factors that most often extend a Keycloak 25 to 26 upgrade, with why each one matters and what to check in your own environment. Read each row against your current deployment, since a single driver such as custom providers or a large database can dominate the plan for the whole project.

DriverWhy it mattersWhat to check
Custom providers and themesEach SPI provider and login theme must compile and behave against the 26 APIs and templates, so every custom component adds test and rebuild work.Count providers, themes and extensions, and confirm which ones depend on internal classes or templates you have not reviewed.
Hostname and reverse proxy settingsHostname v2 and proxy-header handling change how public and admin URLs are resolved, so a misconfigured proxy can break logins, redirects and token issuers.List every hostname, proxy header and path restriction in use, and test admin and frontend URLs separately.
Database size and migration pathSchema migration runs at startup by default, and large tables extend the window needed for the upgrade and the backup you must take first.Check table row counts, confirm whether automatic or manual migration fits, and verify that a restorable backup exists.
Number of realms and clientsMore realms and clients mean more configuration to review for changed defaults, token behavior and client scopes, and more smoke tests to run.Inventory realms and clients, identify the ones that use custom protocol mappers or nonstandard token claims.
Federation and brokering linksLDAP, Active Directory, Kerberos and upstream identity providers each need login and sync tests, and failures often appear only for specific users.List every federation provider and brokered identity provider, and confirm test accounts exist for each.
High availability topologyMulti-node clusters and multi-site designs require rolling restarts, cache behavior checks and a plan for keeping nodes on compatible versions during the change.Confirm the cluster architecture, node count, session cache configuration and whether any site uses the deprecated multi-site model.
Number of environments to validateEach environment, from development through production, must repeat the upgrade and tests, and differences in data or configuration can hide defects until late.Confirm how many environments exist, whether they match production in configuration, and who signs off each stage.

Questions buyers ask before a Keycloak 25 to 26 upgrade

What drives the cost of a Keycloak 25 to 26 upgrade?

The cost follows the amount of change in your deployment, not the version number alone. The main drivers are the number of realms and clients, how many custom themes and SPI providers you run, whether you use the Keycloak Operator, the database size and how many environments need a tested path before production. Each upgrade has a one-time cost for planning, testing and cutover, and a recurring cost for keeping the deployment on a supported minor release. Ask any partner for a quote that lists the environments, the custom code inventory, the test realms and the rollback plan as separate line items, so you can see what you pay for and what you could do yourself. DeployOpen does not publish prices; a quote follows from a written scope.

How long does a Keycloak 25 to 26 upgrade take?

Duration depends on the same drivers as cost: the size of your realm configuration, the number of integrated applications that need token and logout testing, the amount of custom code to rebuild, and how many non-production environments you must upgrade in sequence. Database size matters because schema migration runs at startup by default, and the upgrading guide suggests manual migration for large deployments. Approval cycles in your change process and the availability of application owners for testing often take longer than the technical steps. Ask for a timeline tied to a written scope rather than a generic estimate, and confirm which steps depend on your own change windows.

What must our internal team provide for the upgrade?

Your team needs to provide access and knowledge the upgrade cannot happen without. That includes the current Keycloak configuration export, the database and its backup and restore process, the infrastructure definitions for your reverse proxy and hostnames, and a list of every application, API and service that relies on Keycloak. Your team should also name owners who can sign off on test results for each application, approve the change window and decide who accepts the cutover. Confirm access to non-production environments that mirror production closely enough to test sessions and logout. Missing ownership of these items is one of the most common reasons upgrades slow down.

Can our own team run the Keycloak 25 to 26 upgrade?

Yes, if your team has the skills to read the upgrade notes, run Keycloak in test environments and verify token, session and logout behavior across each integrated application. The upgrading guide and the 26.8 notes cover the changes in the 26 line, and the work is mostly testing and verification rather than new development. Teams with a Kubernetes or Operator-based deployment also need to understand the Operator approval model before they update. A partner adds value when the team lacks time, when custom providers need rebuilding, or when the upgrade must be documented as evidence for an internal review. Whichever route you choose, agree on the written scope and acceptance criteria first.

How do we avoid losing user sessions during the upgrade?

Sessions are handled by enabling persistent user sessions before the upgrade, so that session state is stored in the database instead of only in memory, which lets active sessions survive a restart. Confirm the exact setting and its effect in the upgrading guide, then test it in a staging cluster with real traffic patterns. Plan the cutover so that nodes are restarted in sequence behind your load balancer, and verify that users stay signed in and that refresh and logout still work for each application. Persistent sessions also increase database load, so size the database and check cache behavior before production. Document what happens to sessions that expire during the window.

How are custom providers and themes affected by the upgrade?

Custom SPI providers, login themes and extensions are the most likely source of breakage, because they are compiled against Keycloak internals and templates that can change between releases. Inventory every provider and theme, record which Keycloak APIs each one uses, and rebuild them against the 26 release before deploying. The Protostream cache change and the hostname v2 options also affect code that reads cache or URL configuration, so review those areas specifically. Build a test plan that covers login, registration, password reset, token issuance and admin console actions for each custom component. Start with the upgrading guide and the 26.8 notes to scope the review, then test each custom component on the new release in a staging environment.

How DeployOpen scopes and delivers a Keycloak 25 to 26 upgrade

DeployOpen plans, implements, tests, documents and supports self-hosted open-source platforms inside your own infrastructure, including Keycloak. For a 25 to 26 upgrade, we start from your current deployment, your custom providers and your session requirements, then agree the work in writing before any change is made.

How we scope

  • We inventory your current Keycloak 25 version, database, cluster topology, hostnames and reverse proxy configuration.
  • We list custom themes, SPI providers and client integrations that must be retested against the 26 line.
  • Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts.
  • The written scope states whether session persistence, hostname changes and provider rebuilds are included.

How we build

  • We enable persistent user sessions on Keycloak 25 first, then verify session behavior before moving to 26.
  • We test the Protostream cache change and hostname v2 and proxy-header settings in a staging copy of your realms.
  • We rebuild and test custom providers against the target release and record each failure and its fix.
  • We rehearse the database schema migration on a restorable copy of production data before any cutover.

How we hand over

  • You receive a written upgrade runbook with the order of steps, rollback points and verification checks.
  • You receive a record of configuration changes, test results and open risks for your change and audit files.
  • We walk your operations team through the new hostname, proxy and metrics settings so they can run them.
  • We document which application libraries and clients still need separate upgrade work on your side.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers after the initial upgrade.
  • A retainer can cover later minor releases, such as the quarterly updates in the 26 line, with retesting of your realms.
  • Support scope, response expectations and review cadence are written into the agreement before it starts.
  • Retainer pricing follows from the written scope, and DeployOpen does not publish a price list.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.