8000 Non-destructive realm configuration import that completely excludes existing users #26.5.7 # · Issue #7 · keycloak/keycloak-misc · GitHub
[go: up one dir, main page]

Skip to content

Non-destructive realm configuration import that completely excludes existing users #26.5.7 # #7

Open

Description

@pavan-lang

Description

Problem

We need to update existing Keycloak realms using a declarative JSON baseline without affecting any existing users.

Our current deployment uses a realm JSON configuration that contains realm settings, clients, client scopes, protocol mappers, roles, service-account configurations, authentication flows and other realm-level resources.

We want to apply changes to these resources while ensuring that the user database remains completely untouched.

Expected behaviourNon-destructive realm configuration import that completely excludes existing usersntroducing a configuration import/update mode such as:

"--preserve-users=true"

or:

"--exclude-users=true"

Current limitations

  1. Full realm import with override
    Using:
    kc.sh import --file=portal-realm.json --override=true
    overwrites the existing realm configuration. This is unsuitable for routine configuration updates in an environment containing registered users and runtime-managed data.
  2. Partial import
    Using:
    kcadm.sh create partialImport -r portal -s ifResourceExists=OVERWRITE -o -f portal-realm.json
    supports only a subset of realm resources. It does not provide a complete declarative update mechanism for realm settings, client scopes, authentication flows and other configuration.
    Additionally, partial import can affect generated service-account users, as reported in issue #46674.
  3. Admin REST API
    Updating all realm configuration through individual Admin REST API calls requires multiple operations and custom orchestration. Authentication flows, their executions and authenticator configurations are particularly difficult to manage as a single consistent configuration.

When enabled, the import should:

  1. Never create, update or delete existing regular users.
  2. Never modify user attributes, credentials, required actions or user profile data.
  3. Never delete or recreate generated service-account users.
  4. Never modify user sessions or federated user records.
  5. Continue applying changes to supported realm-level resources, including clients, client scopes, protocol mappers, roles and authentication flows.
  6. Allow role mappings for service accounts to be updated without recreating the service-account users.
  7. Preserve all resources not explicitly included in the configuration.
  8. Support repeated, idempotent execution.

Our use case

We operate approximately 10 independent Keycloak deployments across different regions.

Each deployment uses the same baseline realm configuration, with region-specific values.

When we introduce new clients, client scopes, protocol mappers, roles or authentication-flow changes, we need to roll these changes out across existing realms.

However, these realms already contain registered users and active application environments. Replacing or modifying user data during configuration deployment is unacceptable.

We therefore need a supported way to update realm configuration independently of user data.

Environment

  • Keycloak: 26.5.7
  • Deployment: Kubernetes
  • Deployment mechanism: Helm
  • Database: External database
  • Configuration: JSON realm baseline
  • Markets: Approximately 10 independent deployments

Expected outcome

A supported non-destructive configuration update mechanism that allows us to manage realm configuration as code while guaranteeing that existing user data is excluded from the operation.

The user-preservation behaviour should be explicit, documented and testable.

Discussion

No response

Motivation

No response

Details

No response

Activity

  1. changed the title [-]Non-destructive realm configuration import that completely excludes existing users[/-] [+]Non-destructive realm configuration import that completely excludes existing users #26.5.7 #[/+] on Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0