Model A: a realm per tenant
A realm is Keycloak’s hardest boundary. Each one has its own users, groups, roles, clients, identity providers, authentication flows, password policy, session lengths and signing keys. A user in one realm does not exist in another, even with the same email address.
That isolation has a price your app pays:
- Each tenant has its own issuer, such as
https://auth.yourcompany.com/realms/tenant-a. Your app has to pick the realm before sign-in, usually from a subdomain or a tenant picker, and accept tokens from many issuers. - Clients, scopes, mappers and flows exist once per realm. A change you want everywhere is made in every realm, by hand or through the admin REST API.
- Each realm counts against the plan: up to 2 on Starter, 20 on Premium and 100 on Enterprise.
In return, a tenant admin can be given rights over one realm only, and one tenant’s settings can never leak into another’s.
Model B: one realm with Organizations
Organizations, fully supported since Keycloak 26.0, divide one realm by tenant. Each organization has its members, its email domains, its own groups and, when it wants one, its own identity provider. Your app has one client and one issuer; the tenant arrives in the organization claim when the client asks for the organization scope.
What stays shared is everything that belongs to the realm: the password policy, brute-force settings, session and token lifetimes, the login theme and the default flows. A client can override the browser flow for itself, but not per organization. And because users are unique in a realm, one email address is one account, which can be a member of several tenants.
Delegation has improved in recent releases: Keycloak 26.7 added manage-organizations, view-organizations and query-organizations roles, and fine-grained admin permissions can limit an administrator to specific organizations.
Side by side
| A realm per tenant | One realm, Organizations | |
|---|---|---|
| Users | Separate per tenant | One account per person, member of one or more tenants |
| Login settings | Per tenant | Shared by all tenants |
| Signing keys | Per tenant | One set |
| Your app trusts | One issuer per tenant | One issuer |
| Adding a tenant | A realm, its clients and settings | An organization |
| Tenant-only admins | Realm admin roles | Organization roles and fine-grained permissions |
| Limit on our plans | 2, 20 or 100 realms | One realm for all tenants |
Mixing the two, and moving later
A common shape is Organizations for most tenants and a dedicated realm for the few that need their own policy or keys. Your app then handles two kinds of issuer, which is worth designing for from the start: resolve the tenant first, then the issuer.
A tenant that needs more than a realm, such as its own uptime or another region, can have a cluster of its own: each RealmDeploy order is a separate cluster in the region you pick.
Moving tenants between models is a realm export and import, planned and tested on a copy first. On Premium and Enterprise, the 10 service hours a month can go to that work. The realm export analyzer shows what a realm holds before you move it.