Manage Users and Roles
Keycloak provides comprehensive user lifecycle management and fine-grained role-based access control (RBAC). Users, roles, and groups are managed per Realm.
TOC
User ManagementCreate a UserReset User PasswordRole ManagementCreate a Realm RoleAssign Roles to UsersGroup ManagementCreate a GroupAdd Users to a GroupComposite RolesAdmin Access ControlMaster Realm vs Realm-Specific AdminsFine-Grained Admin RolesPermission BoundariesCreate a Delegated AdminUser Management
Create a User
- Log in to the Keycloak Admin Console and select the target Realm.
- Click Users in the left navigation bar.
- Click Create new user.
- Fill in the required fields:
- Click Create.
- Go to the Credentials tab to set an initial password.
Reset User Password
- In the Admin Console, go to Users and select the target user.
- Click the Credentials tab.
- Click Reset password.
- Enter a new password and toggle Temporary if you want the user to change the password on next login.
- Click Save password.
Role Management
Keycloak supports two types of roles:
Create a Realm Role
- In the Admin Console, go to Realm Roles.
- Click Create role.
- Enter a Role name and optional Description.
- Click Save.
Assign Roles to Users
- Go to Users and select the target user.
- Click the Role mapping tab.
- Click Assign role.
- Select the roles to assign and click Assign.
Group Management
Groups allow you to manage role assignments for multiple users at once. Assign roles to a group, and all group members inherit those roles automatically.
Create a Group
- In the Admin Console, go to Groups.
- Click Create group.
- Enter a Name and click Create.
- In the Role Mapping tab of the group, assign the desired Realm or client roles.
Add Users to a Group
- Go to Users and select the target user.
- Click the Groups tab.
- Click Join Group, select the group, and click Join.
Composite Roles
A Composite Role is a role that contains other roles. When a user is assigned a composite role, they inherit all roles included in it. This simplifies permission management for complex role hierarchies.
To create a composite role:
- Create a Realm role.
- In the role's detail view, enable Composite role.
- In the Associated roles tab, add the child roles.
Admin Access Control
Keycloak provides fine-grained control over who can administer realms and what operations they can perform.
Master Realm vs Realm-Specific Admins
Fine-Grained Admin Roles
The realm-management client in each realm provides granular admin roles. Roles follow a view-* / manage-* pattern — view-* grants read-only access, manage-* grants full CRUD access and implicitly includes the corresponding view-* permission.
The query-* roles provide minimal list/search access needed for Admin Console navigation without granting full read access to resource details. When creating delegated admin accounts, assign query-* roles alongside specific manage-* or view-* roles so the admin can navigate the console properly.
Permission Boundaries
Fine-grained admin permissions have the following boundaries:
- Delegated admins cannot grant roles they do not have themselves. A user with
manage-usersbut withoutmanage-clientscannot assign client roles. - Delegated admins cannot access other realms unless they also have roles in those realms.
- The
realm-admincomposite role includes all individual admin roles. Assign it only when full realm administration is intended.
Create a Delegated Admin
To create an admin user who can only manage users in a specific realm:
- Create a user in the target realm.
- Go to the user's Role mapping tab.
- Click Assign role > Filter by clients.
- Search for
realm-management. - Assign
view-users,manage-users,query-users, andquery-realmsroles. - The user can now access the Admin Console at
https://<keycloak-host>/admin/<realm>/consolewith limited permissions.
Each realm has a dedicated Admin Console URL: https://<keycloak-host>/admin/<realm>/console. Delegated admins should use this URL instead of the global admin console.