Keycloak delegated tenant administration for customer admins
A SaaS or B2B platform on Keycloak usually needs each customer's administrators to manage their own users, invitations and sign-in settings without being able to see or change any other tenant. In Keycloak, delegated administration rests on three levers: realm-level admin roles, organization-level management, and fine-grained admin permissions. Choose the lever by the tenant model you already run. If each customer has its own realm, realm admin roles are the natural boundary, but they grant broad rights inside that realm and cannot be narrowed to one customer's users. If customers are organizations inside one shared realm, organization-level management keeps each customer's membership, domains and invitations in its own scope. Fine-grained admin permissions let you grant narrower rights, such as managing users in a set of groups, when neither of the other two fits.
Before you commit, confirm in the documentation for the exact Keycloak release you run how fine-grained admin permissions (version 2) and organization-level administration behave, including which admin actions each can cover and which still require a realm-wide role. The Keycloak server administration guide is the primary reference for these settings. Test the boundary with two tenant admin accounts in a non-production realm: confirm that one cannot list, search or modify the other's users, groups or identity providers through the admin console or the Administration REST API. Treat any gap you find as a blocking issue, not a documentation detail.
Plan delegated admin work as a design and testing task, not a checkbox. Decide who creates the first tenant admin, how that role is removed at offboarding, which actions tenant admins may take on their own (for example, resetting a user's credentials or assigning groups), and which must stay with your platform team. Record each decision, because the same rules have to be re-tested after every Keycloak upgrade. Ask your DeployOpen or internal team to confirm in writing which tenant admin actions are covered by audit events in your release, since the audit trail of delegated actions is what your compliance reviewers will ask for first.
Delegation options and when each fits
This table compares realm-level admin roles, organization-level management and fine-grained admin permissions on what each can scope, how many tenants each suits, the upkeep it needs and the version checks to run first. Read the risk row before granting any broad role, because it sets the baseline for the other two options.
| Option | What it can scope | Tenant count and admin effort |
|---|---|---|
| Realm-level admin roles | Whole realm: every user, client and setting in it. Scoping to one tenant is not possible with built-in realm roles alone. | Suits one realm per tenant with few tenants. Effort grows with each realm, since roles are granted and reviewed per realm. |
| Organization-level management | Members, domains and identity providers linked to one organization inside a shared realm. Confirm which admin actions this covers in your version. | Suits many tenants sharing one realm. Effort is lower per tenant, but confirm the organization features in the release you run. |
| Fine-grained admin permissions (V2) | Specific admin actions on chosen groups, clients or users, applied per tenant. Confirm that the groups or resources you need can be scoped in your release. | Suits tenants that need narrow, delegated control. Effort is higher at setup because policies must be written and tested for each tenant pattern. |
| Risk of granting a broad realm role to a tenant admin | A tenant admin with a realm-wide role can read and change users, clients and settings of every other tenant in that realm. | Avoid as a default. If it is used for a pilot, record the exception, limit its life and test that other tenants stay out of reach. |
| Audit of delegated admin actions | Admin events record who changed what. Confirm that admin event logging is enabled and retained for each option you choose. | Effort rises with tenant count because each tenant's actions must be traceable to a named person. |
| Version and feature checks | Confirm in the release notes for your version whether V2 permissions, organization management and the admin actions you need are enabled and supported. | Re-check on each upgrade, since admin permission behavior can change between minor releases. |
What fine-grained admin permissions can and cannot scope
Fine-grained admin permissions let you give a customer administrator power over a defined slice of a realm rather than the whole realm. In Keycloak, an administrator can be granted specific actions, such as viewing, managing or mapping users and groups, and those grants can be limited to a particular group, organization or set of users. For delegated tenant administration, this is the mechanism that lets a customer's admin reset passwords, manage memberships and assign roles for their own people while leaving every other tenant's accounts out of reach. The model works on resource types and operations, so the first design task is to write down which actions each tenant admin needs and which must stay with your platform team. Keycloak's implementation has changed across releases, including a newer V2 model, so confirm the exact permission names, the scopes each one supports and the Keycloak release that introduced V2 against the server administration guide for the version you run, before you build anything on them.
The limit to plan for is that a scoped permission only covers the resources it is scoped to. Realm-level objects such as clients, client scopes, identity providers, authentication flows and realm settings are shared by every tenant in the realm. If a tenant admin is granted rights over clients or identity providers without a separate scope on those objects, they can often change configuration that affects other tenants, including redirect URIs, sign-in methods and login flows. Test this directly: sign in as a scoped test admin in a non-production realm, attempt to edit a client and an identity provider belonging to another tenant, and record every action that succeeds. Keep shared configuration under your platform team's control, and decide explicitly which of those objects, if any, a tenant admin may touch.
Confirm three things with your Keycloak version before the design is final: which resources can be scoped, which actions can be granted on each, and whether the scoped grant also applies to objects created later by the tenant. Ask your Keycloak support channel or your implementation partner to show the result in a test realm, not only in documentation. Anything the scoped model cannot reach will need a control outside Keycloak, such as a restricted automation account, an approval step in your onboarding workflow or a separate realm, and that choice shapes the cost and maintenance of the tenant model. Record the outcome of each test so the audit trail for delegated administration can show what was tested and what was found.
Delegation patterns by tenant model
In this model, all tenants share one realm and each customer is represented as an organization. Delegated administrators are granted permissions that apply to a single organization, so a customer admin can manage the members, invitations and domains of their own organization without access to the others. The platform team keeps control of the realm itself, including realm-level settings, client registrations, authentication flows, keys and the admin role assignments that define what a delegated admin can touch.
- Scope: Fine-grained admin permissions can be tied to organization membership, so the delegated admin's reach follows the organization they belong to.
- Central control: The platform team owns realm configuration, shared clients, global authentication policy and the permission model itself.
- Growth pressure: Each new tenant adds organization records and permission assignments in one realm, so review the admin console experience and token contents as the count rises.
- Shared surface: Any mistake in a realm-wide permission affects every tenant, so test delegated roles against a second tenant before release.
- Confirm: Check the current permission model in the Organizations and fine-grained admin documentation for your Keycloak version, including which actions can be scoped to an organization.
Before choosing this pattern, confirm that your tenants can share realm-level settings such as password policy and session lengths. Review the sibling tenant model comparison for isolation and migration trade-offs.
In this model, each tenant gets its own realm with its own users, clients, roles and settings. Delegation is simplest to reason about because a customer admin is granted the realm administration role for their realm only, and realm boundaries provide strong separation of users and configuration. The cost is that the platform team must run and automate far more realm objects, and every realm change is a separate administrative task.
- Scope: A delegated admin receives realm-scoped administration, which is a coarse boundary but a clear one.
- Central control: The platform team still owns the Keycloak server, database, clustering, realm templates and the process that creates and removes realms.
- Growth pressure: Admin role composites, token size and cache use grow with realm count, and the admin console slows as realms multiply.
- Automation dependency: Onboarding, offboarding and role templates should run through the Admin REST API or infrastructure as code rather than by hand.
- Confirm: Ask how your Keycloak version handles administrative roles across many realms, and test admin console responsiveness with a realistic realm count from your own plan.
The main risk with this pattern is drift: realms that were created at different times can end up with different settings. Plan a regular comparison of realm configuration against a template so delegated changes do not silently diverge.
In this model, one realm holds all users, and tenant membership is recorded in groups, client roles or attributes that the application reads. Keycloak does not provide tenant-scoped administration in this design out of the box, so delegation depends on how the platform team models groups and what the application enforces. This pattern gives the least administrative isolation, and it places the most responsibility on the application and on the access rules the platform team writes.
- Scope: Delegated admins can be given rights over a group subtree or a set of client roles, but the boundary is only as strong as the admin permission design you implement and verify.
- Central control: The platform team keeps realm-wide policy, clients, token mappers and the rules that decide which group a delegated admin may change.
- Growth pressure: Group trees and role mappings become harder to audit as tenants grow, and tokens can grow when users belong to many groups.
- Application dependency: The application must enforce tenant isolation on every request, because Keycloak alone will not stop a user from seeing data outside their tenant.
- Confirm: Verify with tests whether a delegated admin can see or change users outside the intended group, and record the result before go-live.
Because isolation rests on configuration and code, treat this pattern as the one that needs the most negative testing. Compare it with the sibling page on tenant models before you commit.
How to set up a scoped tenant admin
This sequence takes a Keycloak deployment from version and tenant model confirmation to a tested tenant administrator who can manage only their own users, with admin events recorded for every delegated action.
Confirm the Keycloak version and tenant model
Before creating anything, record the Keycloak version your environment runs and the tenant model you chose: organizations inside one realm, or a realm per tenant. Check the version against the release notes and the server administration guide, because fine-grained admin permissions and organization management behave differently across releases. Confirm this with your platform owner and write the answer down. The step is done when the team agrees in writing on the version and the model, and when someone has opened the admin console and confirmed the Organizations menu or the realm list matches that choice.
Create the organization or realm boundary
Create the tenant boundary that the delegated admin will sit inside. For organization-based tenancy, create one organization for the test tenant, add a test domain, and add one test user as a member. For realm-based tenancy, create a dedicated test realm with its own users and clients. Do not place the test tenant in the platform administration realm. The check is to list organizations or realms as a platform admin and confirm the new tenant appears once, with no members or settings copied from another tenant.
Define the scoped permission set
Using fine-grained admin permissions (V2) where your version supports them, define the actions a tenant admin needs: viewing and managing users, resetting credentials and managing group membership inside the tenant. Attach these permissions to a role or policy that targets only the test tenant's organization or realm, and leave out realm-wide roles such as manage-realm or manage-clients. Ask the platform team to confirm which permission names your version exposes, since the names are version specific. The check is to read the effective permissions for the role and confirm each one is scoped to the test tenant and not to all tenants.
Create a test tenant admin with no platform roles
Create a test user who will act as the tenant administrator. Make them a member of the test tenant only, and assign them the scoped role from the previous step. Confirm the user holds no platform-wide roles, no membership in the master or administration realm roles, and no client scopes that grant broader admin access. Sign in to the admin console as this user in a private browser session. The check is to confirm the console shows only the test tenant and that the user's role mappings contain nothing outside that tenant.
Verify the admin can manage their own users only
As the test tenant admin, create a user, reset a password, add the user to a tenant group and disable the account inside the test tenant. These actions should succeed. Then attempt the same actions on a user in a second test tenant, and try to list the second tenant's users or open its settings. Each attempt should fail with an access denied response or return no records. Record the results in a table with the action, target tenant and outcome. The step is done when every action inside the tenant succeeds and every action against another tenant is denied.
Verify the admin cannot escalate privileges
Still signed in as the test tenant admin, try to change the scoped role, add yourself to a broader role, create a new realm or organization and edit an identity provider. These should all be refused. Also check the Administration REST API directly with the admin's token, since the console and the API enforce the same permissions and a gap in one shows up in the other. The check is a recorded list of refused actions with their error responses, and no change visible to a platform admin afterward.
Enable admin event logging and confirm events appear
Turn on admin events and include representation data if your audit policy requires it, then store events in the database. Have the test tenant admin perform one create, one update and one delete on a test user. Search the admin events list as a platform administrator and confirm each action appears with the acting user, the target resource, the realm or organization and a timestamp. Confirm the events also reach your central log pipeline if one is configured. Check the retention setting with your audit team, because the default retention for stored events is a configuration choice you must make.
Security risks in delegated admin access
Delegated administration removes the operator from routine user work, so the risks move to the edges: which roles a tenant admin holds, where the admin surface is reachable, and what happens to access when a tenant changes. Each card names one failure mode and the control that closes it.
Broad composite roles granted by accident
A tenant admin role built from a composite can quietly include realm-management rights that reach every tenant in the realm. Review each delegated role by listing its effective permissions, not only the role names you assigned. Check that no composite includes realm-level manage rights, and confirm the result with a test account that tries to read another tenant's users.
Keycloak docsTenant admins reaching the admin console
If the admin console and Administration REST API share the public hostname, tenant admins log in through the same surface as end users, and every admin endpoint is exposed to the internet. Serve admin traffic on a separate hostname or context path, and restrict it at the reverse proxy to networks your team controls. Confirm that the public hostname returns no admin console.
Production guidePrivilege escalation through self-editing
A tenant admin who can edit their own user, role mappings or client settings can grant themselves rights beyond their delegation. Exclude the admin's own account and the roles that govern delegation from the scope of what tenant admins can change. Test by attempting to add a stronger role to your own account and confirm that the change is refused and logged.
Shared clients and providers exposing configuration
A shared client or identity provider used by several tenants lets one tenant admin read or alter settings that affect the others, such as redirect URIs, signing keys or client secrets. Keep per-tenant identity providers and clients separate where the admin scope needs to differ, and treat any shared object as a platform-owned resource. Ask which objects each tenant admin can view and edit, and record the answer.
Stale admin accounts after offboarding
When a tenant leaves or an employee changes roles at the customer, their admin account can keep its delegated rights for weeks. Tie tenant admin accounts to a documented offboarding step that disables the account, removes its role mappings and revokes its sessions. Run a periodic review that lists every account holding a delegated role against the customer's current contact list.
Service accounts with excess admin rights
Automation such as onboarding scripts often runs as a service account with broader rights than its task needs, and its client secret becomes a standing path to every tenant. Grant the service account only the realm or organization permissions its job requires, and store its secret in a managed secrets store with rotation. Review the account's effective roles whenever a new automation step is added.
How to audit delegated admin actions
Delegated administration is only defensible if you can answer one question for any change: which tenant admin made it, to which user, role or identity provider, and under which tenant. Customers and auditors will ask this directly, so decide before go-live how Keycloak's admin and login events will answer it. Start by listing the actions your delegated admins can perform through fine-grained admin permissions and organization-level management, such as creating or disabling users, changing group membership, assigning roles, and editing an organization's identity provider or domains. Then confirm, for your Keycloak release and deployment, which of those actions produce admin events, which produce login events, and what fields each event carries, including the realm, the acting user and the resource affected. The event types, retention settings and export options vary by release and configuration, so verify them against the server administration guide (Keycloak server administration guide) and a test realm before you rely on them.
Attribution depends on identity hygiene. Each tenant admin should sign in with a named account from their own identity source, never a shared account or a single service credential used for every customer. If your automation uses the Admin REST API with a client credential, record which pipeline or ticket triggered each call, because otherwise the event will show a service account rather than a person. Define retention and forwarding in the same exercise: events stored only in the Keycloak database are hard to correlate across tenants, so plan to export them to a central log platform, set a retention period that matches your contractual and regulatory obligations, and test that a sample admin action arrives there with the tenant identifier intact.
Keep metrics and audit separate. Metrics exposed at /metrics when --metrics-enabled=true is set show request rates, latency and cache behavior, which help with capacity and incident response, but they record counts and not the identity of the person who made a change. They do not replace an audit trail. Ask your DeployOpen or internal team to produce a written evidence pack: a list of delegated actions, the event type that records each one, the log destination, the retention period, and a restore test showing an investigator can reconstruct one tenant's change history end to end.
What to confirm before you promise tenant isolation
Delegated administration only isolates tenants if the Keycloak release, the data model and the admin surfaces all behave the way your design assumes. The cards below list the items to verify in your own environment before you make isolation commitments to customers or auditors.
Release and permission model
Confirm that the Keycloak release you plan to run includes the fine-grained admin permissions version you intend to use, and that its behavior matches the documentation for that exact version. The current release is 26.8.1, but your production line may be older or pinned by a distribution. Test the permission scopes you need, such as managing users in one organization only, on a non-production instance before you design around them.
Keycloak docsOrganization domains and membership
Check how the Organizations feature handles domains, membership and admin rights when a tenant's email domain overlaps another tenant's or changes owners. Ask who can add a domain to an organization, whether a user can belong to several organizations, and what happens to membership when a domain is removed. These answers determine whether a customer admin can ever reach users outside their tenant.
Theme and console customizations
Review every custom theme, admin console extension and SPI provider for code paths that read or display users, groups or roles across tenants. A customization that lists all users or exposes a shared attribute can bypass the permission model entirely. Include these components in your upgrade testing, because each one carries its own maintenance cost when Keycloak changes.
Realm and role scale
Measure admin console responsiveness and token size with the number of realms, roles and composite roles you expect at peak, not with a small test set. Many realms and deeply nested composite roles can slow the console and grow tokens, which affects how far you can push per-tenant delegation inside one realm. Run this load check against a realistic dataset in your own infrastructure before you commit to a model.
Administration REST API exposure
Confirm that the Administration REST API and admin console are reachable only on the hostname or path you intend, and that delegated admins cannot call endpoints that a console restriction would hide. Keycloak's production guidance separates admin endpoints from public frontend URLs, so verify that separation at your reverse proxy, including path restrictions and the rules for service accounts that automate tenant work.
Production guideAudit output and auditor acceptance
Confirm which delegated admin actions Keycloak records, where the events are stored, how long they are kept, and whether they include the acting admin, the tenant scope and the target object. Then ask your auditors whether this output meets their evidence expectations. DeployOpen prepares controls and evidence for assessments, but only independent auditors and certification bodies decide whether the evidence is sufficient.
Questions buyers ask about delegated tenant administration
What does a delegated tenant administration project cost, and what drives the price?
The price depends on the scope agreed in writing, not on a standard package. The main drivers are how many tenant admin roles you need, how many realms or organizations they span, how much the admin console must be customized, how many systems tenant admins act on besides Keycloak, and how much audit reporting you want. Ask for a quote that lists each role, each permission set, each integration and each test case as separate line items. Keycloak itself is open source under Apache 2.0, so the recurring cost is mainly infrastructure, operations and any upgrade or support retainer, which should be stated separately from the one-time build fee.
How long does it take to build and test a scoped admin model?
The duration follows from the number of roles, the number of tenant types and the amount of testing needed, so ask the vendor for a timeline tied to a written scope rather than a generic figure. A typical sequence is to confirm the permission model, build roles and policies in a non-production environment, automate tenant provisioning, test isolation across tenants, and then run a controlled pilot with one or two real customer admins. Each stage should have named deliverables and exit criteria. Keycloak's own release planning, with four minor releases a year, means the build should include time to validate against the version you plan to run.
What does our team need to provide during the engagement?
Your team usually provides the business rules for who may manage what, the list of tenants and their domains, the identity providers each tenant uses, the applications that depend on Keycloak, and a named owner who can approve permission decisions. You also need access to non-production and production environments, the hosting platform, the database, and the mail and monitoring systems. Agree in advance who signs off on each role definition, because most delays come from unresolved questions about what a tenant admin should be allowed to do.
Can our own engineers build delegated administration without outside help?
Yes, if your team already runs Keycloak in production, has experience with the Admin REST API and can write automated tests for access control. The harder parts are usually not the console clicks but the modeling decisions, the audit design and the isolation tests that prove one tenant cannot see another. Teams that build it alone should plan for a review by someone who has not written the model, and should budget time for upgrades, since permission behavior can change between releases. An outside partner can work alongside your engineers, or hand over documentation and tests your team maintains.
What happens when a tenant admin needs a permission the model does not offer?
Handle it as a change request, not a workaround. First confirm whether the permission exists in the fine-grained admin permissions model for your Keycloak version, and whether it can be scoped to a single organization or group. If it cannot, decide whether to grant it through a documented custom extension, route the action through an internal service with its own authorization and audit trail, or decline it. Avoid granting realm-wide admin roles as a shortcut, because that breaks isolation. Record each decision with an owner and a review date so the permission model stays explainable to auditors.
How do we test that tenant isolation actually holds?
Write tests that log in as an admin of tenant A and attempt every relevant action against tenant B's users, groups, clients, identity providers, events and audit records, through both the console and the Admin REST API. The expected result for each cross-tenant attempt should be a denial, and the test should check the audit log as well. Repeat the suite after each Keycloak upgrade, after each role change and after each onboarding automation change. Independent security testing can add an outside view of the same boundaries, which is useful before tenants with sensitive data go live.
How do we audit what delegated admins do?
Start by confirming which admin events Keycloak records for your version and configuration, who can read them, and how long they are kept. Then decide where events are forwarded, how each event is linked to the acting tenant admin, and how you will review them. Metrics and logs help with operations but are not a substitute for an audit trail. Ask the partner to show a sample report for a tenant admin action, including who acted, on which object, in which organization and when, and to document how you will retain those records for your compliance requirements.
How DeployOpen scopes and delivers delegated admin access
DeployOpen plans, builds, tests and documents delegated tenant administration in Keycloak inside infrastructure you control. We start from the admin roles your customers need, then configure, verify and hand over the permission model so your own team can run it after the engagement ends.
How we scope
- Inventory which customer admin tasks must be delegated, such as user creation, password resets and invitations.
- Map each task to a Keycloak permission scope, and record which tasks stay with your platform administrators.
- Agree the written scope, deliverables and timeline with you before any configuration work starts.
- Confirm which Keycloak version and deployment model your team runs, because admin permission features vary by release.
How we build
- Configure fine-grained admin permissions V2 and scoped admin roles on a non-production realm first.
- Set organization-level management so each tenant's administrators only see their own members and settings.
- Test cross-tenant access attempts, including direct Administration REST API calls, against the expected denials.
- Connect admin event logging to your log platform and confirm delegated actions are attributable to a named administrator.
How we hand over
- Deliver a permission matrix that lists each delegated role, its allowed actions and its explicit exclusions.
- Document the runbook for granting, reviewing and revoking tenant admin access, including offboarding steps.
- Walk your platform and security teams through the configuration and the test evidence before production cutover.
- Provide a retest of the permission model after changes, so the matrix stays accurate as tenants are added.
How we support
- Support is available as a retainer for permission reviews, Keycloak upgrades and changes to tenant admin roles.
- Retainers can include recurring checks that delegated admin permissions still match the documented matrix.
- Review the permission model again after each Keycloak upgrade, because admin features can change between releases.
- Ask for the retainer scope, response expectations and what is covered in writing before you sign.

