Keycloak user impersonation for support teams: when a support engineer needs to see what the user sees
A user reports that sign-in fails or that an application shows the wrong access, and the problem does not reproduce from your own administrator account because your account has different roles, groups and attributes. Keycloak's impersonation feature lets a permitted administrator act as that user from the user page in the Admin Console, so the support engineer can see the same login flow and token claims the user receives. The feature is supported and enabled by default as impersonation:v1 in the Keycloak feature set, and any user with the impersonation role in the realm can start it from the Actions list on the user page. Confirm the feature state in your own build before you rely on it, because a hardened configuration may disable it.
The main trade-off is that an impersonated session carries the user's identity, not the administrator's. Anything the support engineer does during that session is attributed to the user in the application, and the session can read or change data the user is allowed to reach. That makes the people who hold the impersonation role as important as the feature itself. Decide which roles or support tiers receive the role, keep the list small, and avoid granting it through a broad composite role that also covers unrelated administration. Review membership on a schedule and remove it when someone changes teams.
Before the first use, agree the controls in writing with your security and compliance teams. Confirm which realm events and admin events are stored, how long they are kept, and where they are forwarded, because the audit trail is only useful if it links the impersonating administrator to the impersonated user and the time window. Define when impersonation is allowed (for example, only after the user has raised a ticket), what the engineer must record in the ticket, and whether the user is notified. Test the whole chain in a non-production realm first, including the audit records it produces, so the first production use is a known procedure rather than an experiment.
Who should hold the impersonation role in each realm
This table compares three ways to grant the impersonation role in a Keycloak realm: a dedicated support group, existing administrator permissions, and a narrow custom role. Read each row for who it fits, what access it exposes, and what to confirm in the realm before assigning it, because the role applies only to users in the realm where it is granted.
| Option | Who it fits | What it exposes | What to confirm before granting |
|---|---|---|---|
| Dedicated support group with the impersonation role | Support organizations with a defined tier and a named owner for access reviews | Sign-in as any user in the realm, so the session carries that user's roles, groups and client access | Which users and groups are in scope, whether the role is limited to one realm, and who approves membership changes |
| Broader administrator permissions | Small teams where administrators already manage users and the impersonation step adds little new risk | Impersonation comes along with user management rights, so every administrator can act as any user they can manage | Whether administrators need impersonation at all, and whether admin accounts are separate from daily work accounts |
| Narrow custom role for a small support tier | Organizations that want a few trained staff to impersonate only for reproduction work | Impersonation limited to people holding the custom group, with fewer staff able to start a session | That the role is assigned only in the intended realm, that scope of target users is documented, and that the group is reviewed on a set schedule |
| Impersonation held in the master realm | Rarely a good fit for application realms | Access that may extend beyond the realm the support team is responsible for | Whether the realm boundary still matches the support team's responsibilities before any grant is made |
| Shared or generic support account | Almost no organization should use this | Actions cannot be traced to one person, which weakens the audit trail | Whether each support person can sign in with an individual identity before the role is assigned |
Starting impersonation from the Admin Console
This sequence takes a support engineer from an enabled feature to a reproduced user problem, with a check at each step so the access is granted, used and ended as intended. It produces a clear record of who impersonated whom, in which realm, and for what purpose.
Confirm the impersonation feature is enabled
A realm administrator confirms that the impersonation:v1 feature is enabled on the Keycloak server. The feature is enabled by default, but the team should verify it in its own deployment rather than assume it, because a hardened configuration may have changed it. Check the server's feature settings against the Keycloak features guide and record the Keycloak version in use. The step is done when the feature shows as enabled on the running server, not only in a configuration file.
Assign the impersonation role to a support group
An administrator with rights to manage roles in the target realm assigns the impersonation role to a dedicated support group, not to individual accounts. Any user holding that role in the realm can impersonate a user from the Actions list on the user page, so the group membership is the real access decision. Keep the group limited to the people who need it. The step is done when the group's role mapping shows the impersonation role and a test member sees it in effect.
Sign in to the Admin Console as a support user
A support engineer signs in to the Admin Console using their own named account, with the realm that holds the target user selected. Shared or generic support logins make the audit trail useless for attribution, so each engineer should have a separate account. Confirm the realm name in the console header before going further. The step is done when the console loads in the correct realm and the engineer's account shows the expected group membership.
Open the target user's page
The support engineer searches for the target user in the Users list of the correct realm and opens the user's details page. Confirm the username and email against the support ticket so the session is started for the right person. Do not open the account of a different user that shares a similar name. The step is done when the page header shows the expected user and the realm matches the ticket.
Choose impersonate from the Actions list
On the user page, the engineer opens the Actions list. The impersonate option appears only for accounts that hold the impersonation role in that realm, so its absence is itself a check: if it is missing, stop and confirm the group assignment rather than seeking another route. Select impersonate to start the session. The step is done when Keycloak opens the user's session and the engineer sees the user-facing view that the reproduction requires.
Reproduce the problem and record the findings
The engineer follows the steps in the ticket inside the impersonated session and notes what the user sees, including the time, the application involved and any error text. Keep the reproduction to what the ticket requires, since everything done during the session is attributed to the impersonating engineer in the logs. Record the findings in the ticket before ending the session. The step is done when the problem is reproduced or ruled out and the notes are saved against the ticket.
End the session and verify the event log
The engineer ends the impersonated session and confirms that the console has returned to the support account. A lead then checks that the impersonation event appears in the configured event log, with the impersonating administrator and target user recorded. If it does not appear, the event settings in the realm need review before the next session. The step is done when the event is visible in the log and the ticket references it.
How a support session moves from request to audit record
The session starts when a support engineer signs in to the Admin Console with their own identity and MFA. Keycloak checks that the engineer holds the impersonation role in the realm before it creates a session for the target user, which is the trust boundary to watch: the engineer's identity and the user's identity stay separate. Each hand-off, from the role check to the reproduction and the event record, should be confirmed in your own environment, and the events should be checked in the realm event log and any SIEM forwarding you configure.
Support impersonation flow from sign-in to the audit record.
What the audit trail records and what to confirm
An impersonation session touches three records: who started it, which account it acted on, and when it ran. Keycloak's documentation covers the identity and permission side clearly, but the exact event coverage depends on how your realm's event settings are configured, so each card below ends with what your team must verify in its own version.
The acting administrator's identity
Every impersonation starts from a signed-in administrator account, so the audit question is whether the record names that person rather than a shared support login. Confirm that support staff sign in with individual accounts through your SSO, that the admin account is not shared, and that the administrator identity appears in both admin and user event records. Test this with a dummy session before relying on it. Check that the realm's admin events capture the acting user, not only the target.
Keycloak docsThe target user
The impersonated account is the person whose data and sessions the support engineer sees, so their record must show that the session was taken on their behalf. Confirm whether the target user's event stream shows the impersonation, and whether the event carries enough detail to tell the user later what happened. Also confirm whether impersonation changes what the target user can see in their own account, since a user reviewing their history should not be confused by an unexplained session.
Timing of the session
Investigators need start time, end time and duration to match a session against support tickets and application logs. Confirm whether Keycloak stores impersonation start and end as distinct events in your version, or whether you must infer the end from the session expiry. Check how session timeouts apply to an impersonated session and whether logout ends it cleanly. Compare the timestamps in Keycloak with those in your ticketing and log systems, since clock drift breaks correlation.
Event settings and retention
Whether the session is recorded at all depends on the realm's user and admin event settings, which are off or limited by default in many setups. Confirm which event types are enabled, whether representations are stored, and how long events are kept in the database before cleanup. Decide retention in line with your audit policy, and confirm that events are forwarded to your SIEM. The sibling topic on audit logging with login and admin events covers those settings and the Listener SPI in detail.
Features guideWhen impersonation is the wrong tool for support
Impersonation is the wrong first move whenever the problem can be reproduced without touching a real person's account. A support engineer who signs in as a customer inherits that customer's sessions, consent grants, linked identity providers and entitlements, so every action taken during the session is recorded against someone who never asked for help. Before starting impersonation, ask whether a test user in a staging realm, or a copy of the user's configuration exported and loaded into a non-production Keycloak, would show the same behavior. Settings such as required actions, authentication flows, client scopes, role mappings and group membership usually explain login and access problems, and they can be compared without signing in as anyone.
The risks grow when the session is live. Impersonation runs inside a production session, so a support engineer who clicks through a workflow may trigger a password reset email, enrollment of a new authenticator, a consent prompt, or a change to profile attributes that the user will see the next time they sign in. Login failures and the events around them are also written to the database, so the investigation itself leaves data behind. Before the session starts, agree which pages the engineer will open, which buttons they will not press, and who approves exceptions. Treat any write made during impersonation as a change that needs its own record.
The answer changes with the realm model. In a single-tenant internal realm, where the users are employees of the organization that runs Keycloak, a staging copy of the realm is often easy to build and the blast radius of a mistake is limited to one workforce. In a multi-tenant customer realm, or a shared realm that serves many business units, the same copy may hold data from several tenants, so exporting it can itself be a data exposure. There the reproduction path is usually a test user in an isolated realm that mirrors the customer's identity provider and client settings, with impersonation kept for cases where that mirror cannot reproduce the fault. Confirm with your security team how exports are handled before choosing this path.
Controls to put around support impersonation
Keycloak grants impersonation through a role, but the role alone does not limit who gets used, why, or how it is reviewed. The cards below are the controls a team should set before enabling impersonation, and each one maps to a Keycloak setting or an operating process the team owns.
Restrict the role to a named support group
Impersonation is available to any user holding the impersonation role in the realm, so the first control is deciding who holds it. Assign the role through a dedicated group for support staff instead of direct user grants, and confirm that no other administrative roles inherit it by accident. Review the group membership on a fixed schedule, and remove people who change teams. Keycloak does not check whether a support agent should be on this list, so the list itself is the control.
Keycloak docsRequire strong authentication for support accounts
A stolen support password could let an attacker impersonate any user in scope, so the accounts that can impersonate need stronger sign-in than ordinary users. Put the support group into a browser flow or conditional authentication that requires a second factor or a passkey for the Admin Console. Check that these accounts cannot sign in with a weaker path, such as a password-only client or a federated login that skips the flow.
Keycloak docsRecord a ticket reference for each session
Keycloak does not ask the impersonating agent for a reason or link the session to a case. Adopt a convention in which every impersonation starts from an open ticket, and have the agent record the ticket ID in the support tool and in the admin event trail where the product allows it. Ask the team to confirm how the reference gets into the audit record in their own setup. Reconcile sessions against tickets each week so unexplained sessions stand out.
Limit which user populations can be impersonated
Not every user should be reachable by support. Decide which populations are in scope, such as end customers in a given organization, and exclude administrators, service accounts and users in regulated or executive groups. Keycloak's role model and group membership can express part of this, but scoping by population may need separate realms, separate groups or a process that blocks requests outside the agreed list. Test the boundary with a non-production account before relying on it.
Review impersonation events on a schedule
Controls that nobody reads do not detect misuse. Set a recurring review of impersonation activity against open tickets, looking for sessions with no ticket, sessions that run long, repeated access to the same account and access to restricted populations. Keep the admin events needed for that review, including their retention, long enough to cover the review cycle and the audit period your organization follows. Confirm the retention and forwarding settings with your security team before go-live.
Feature settingsWhat to confirm before enabling impersonation
Customer realms hold accounts that belong to people outside your organization, so impersonation here carries the most privacy and contractual risk. Start by confirming that the impersonation:v1 feature is in the state your change process approved, since the Keycloak features guide lists it as supported and enabled by default, and decide whether it should stay enabled in this realm at all.
- Feature state: Check the Keycloak version in use and confirm the feature flag value on each production node, not only in the staging configuration.
- Role model: Confirm which users and groups hold the impersonation role in the realm, and whether that role is assigned to a dedicated support group rather than to administrators by default.
- Event settings: Confirm that login and admin events are stored and retained long enough for your review cycle, so each impersonation session can be traced to a named support user.
- Session reach: Confirm what the impersonated session can access in connected applications, including billing, data export and account changes, and whether your application teams have tested those paths.
- Restricted networks: Confirm how the Admin Console is reached in your network design, because the production guide recommends separating admin access from public frontend URLs.
Document the answers before any support user is granted the role, and ask the vendor or your integrator to confirm any behavior not covered in the official docs for your version.
Workforce realms hold employee accounts, and impersonating an employee can expose HR, payroll or internal system data. The main questions here are who in IT or the service desk should hold the role and which employee accounts should ever be impersonable, since some roles such as executives or security staff may need an exclusion.
- Account exclusions: Confirm whether accounts for privileged staff, executives or the support team itself can be impersonated, and how you would prevent it through group design or process.
- Directory linkage: If the realm federates LDAP or Active Directory, confirm whether impersonated sessions still reflect the upstream group membership that governs application access.
- Admin separation: Confirm that the people who hold the impersonation role are not the same people who can change that role assignment, so one person cannot grant and use the capability.
- Audit review: Confirm who reviews impersonation events, how often, and where the records are forwarded if you use a SIEM.
- Connected systems: Confirm which internal applications accept Keycloak tokens and whether they can distinguish an impersonated session from a normal one in their own logs.
Record who approved each of these decisions and when, because internal auditors will ask for the same evidence they request for administrator activity.
Development and test realms usually hold synthetic or copied data, and they are where support staff and engineers first learn the impersonation workflow. The risk shifts toward data copied from production, shared credentials and configuration drift that later reaches production, so confirm how these realms are isolated and how their settings are promoted.
- Data origin: Confirm whether any test users were copied from production, and if so, whether that copy is permitted under your data handling rules and how it is masked.
- Configuration parity: Confirm that the feature state and role model in test match production, so a support procedure rehearsed here reflects what will run live.
- Credential reuse: Confirm that test realms do not reuse production client secrets, admin passwords or federation credentials.
- Network isolation: Confirm whether the test environment can reach production identity providers or downstream systems, and how that path is blocked in an air-gapped or restricted network.
- Rehearsal scope: Confirm which support scenarios you will rehearse, such as reproducing a login failure or a role mismatch, and whether the audit records from those rehearsals look the way your review process expects.
Before promoting any impersonation setting, confirm the exact Keycloak version and the state of the feature in the target environment.
Questions teams ask before setting up Keycloak impersonation
What drives the cost of setting up Keycloak impersonation for support?
The cost depends mostly on how many realms, clients and user populations the role must cover, how many support roles need different limits, and how much audit forwarding and approval design the organization requires. Impersonation itself is a built-in capability: the impersonation:v1 feature is supported and enabled by default, and any user with the impersonation role in a realm can start it from the Actions list on a user page. The work is in the surrounding design: which roles get the permission, how events are captured and retained, and where they are forwarded. Any quote should itemize these pieces separately, and it should state which parts are one-time configuration and which recur, such as access reviews and retention checks.
How many realms and user populations change the effort?
Each realm is configured separately, so the effort grows with the number of realms that support staff will impersonate into. A single workforce realm with one support group is a narrow job. A deployment that serves customers, partners and internal staff from several realms needs a role model for each, a clear rule for which support teams can reach which realm, and tests that confirm one realm's administrators cannot impersonate users in another. Ask the implementation partner to list every realm in scope and to name the role holders for each before the work is priced.
How long does it take to plan a scoped impersonation setup?
The planning window depends on decisions the internal team has not yet made, not on the Keycloak configuration itself. Planning covers the role model, the approval steps for sensitive accounts, the event retention period, and the SIEM destination. Those decisions can take a few sessions when owners are available and much longer when legal, privacy or security reviews must sign off. Ask for a written schedule in the statement of work that shows which decisions are needed by which date, and confirm the timeline with the people who approve retention and access.
What does the internal team need to provide?
The internal team needs to supply the support process the role will serve, the list of user populations and realms, the names of people who own access decisions, and access to a non-production Keycloak for testing. It also needs an owner for the SIEM or log platform that will receive admin events, and someone who can confirm retention requirements. Without these inputs, the configuration tends to reflect defaults rather than the organization's policy. Plan for the security team to review the final role assignments and event settings before they reach production.
Can our own team configure the impersonation role and audit settings?
Yes, a team with Keycloak administration experience can assign the impersonation role and enable the relevant admin and user events in the Admin Console. The steps are documented in the Keycloak server administration guide, and the feature needs no separate installation because impersonation:v1 is enabled by default. The harder part is verifying that the settings hold: testing that only the intended role can impersonate, that the audit trail records each start and stop, and that events reach the log platform. Teams without that verification capacity often bring in a partner for the test and review step only.
Which decisions should we make before the build starts?
Settle four decisions first: which roles may impersonate, which accounts are excluded (such as administrators and the master realm users), whether a second person must approve sensitive impersonations, and how long events are kept. Then decide where events go. Event retention and SIEM design depend on the compliance requirements your auditors apply, so confirm those with your compliance lead rather than assuming a period. Writing these decisions down before configuration prevents the role from being granted by default to every administrator.
What approval process should sit around impersonation?
Impersonation gives a support agent the same access as the end user, so the approval process should match the sensitivity of the accounts. Common controls include a ticket reference required before each session, a second approver for accounts with financial or health data, and a limit on who can impersonate privileged users. Keycloak does not enforce a ticket workflow on its own, so the approval step usually lives in the support tooling or an identity governance system. Confirm with the security team which steps are mandatory before the role is granted.
How DeployOpen scopes and delivers Keycloak impersonation controls
DeployOpen plans, builds, documents and supports the Keycloak impersonation setup inside your own infrastructure, from the role model and Admin Console workflow to the audit and access controls around it. Each engagement starts from a written scope so your security, identity and support leads agree on who can impersonate whom, and under what conditions, before anything changes.
How we scope
- Map which support roles need impersonation, and which realms and user populations they may act on.
- Define who holds the impersonation role and which admin accounts are excluded from being impersonated.
- Agree the reproduction workflow, approval points and the evidence your audit team expects to see.
- Confirm the written scope, deliverables and timeline before any configuration work starts.
How we build
- Configure the impersonation role and realm-level permissions so access follows your support model.
- Set up login and admin event capture so each impersonation session can be traced to a named staff member.
- Test impersonation in a non-production realm, including the paths that should be blocked and the sessions that should be visible.
- Review Keycloak TLS, admin hostname separation and access to the Administration REST API around the feature.
How we hand over
- Document the role assignments, the support runbook and the steps for starting and ending an impersonation session.
- Deliver the test results, configuration records and an event review procedure your compliance team can examine.
- Walk your support and identity administrators through the workflow and the controls that cover it.
- Record the Keycloak version and the feature settings in use so later upgrades can be checked against them.
How we support
- Review impersonation settings again after each Keycloak upgrade, since release notes can change defaults and behavior.
- Offer ongoing support, upgrades and continuous testing as a retainer if your team wants them kept current.
- Retest the controls after role or realm changes so access drift is caught early.
- Confirm retainer terms, response expectations and service boundaries in writing before work begins.

