How do I create an admin user in a realm in Keycloak? I tried /bin/add-user.sh -r myrealm -u admin -p
It gave me the error:
* Error *
Fromyour example, i suppose you want to create an admin that would administrate a new realm. Then an admin form this new realm, different from the master (default) one.
Simply, here is the way to create an admin in a realm.
Master realm, create un new realm (Myrealm)admin role for the new created realmConfigure main title, select RolesRealm Roles tab, click on the button Add Role and give it a name (admin) and a description (Myrealm admin role) and switch on the Composite Roleclient roles field: realm-management, then select it.Available Roles, click [Add selected] button./!\ This role is only availbale to this realm and will affect only users related to the realm.
Role Mappings tab, and send the Available Roles admin to Assigned Roles.Try to login http://keycloak/auth/admin/REALM_NAME/console (replace REALM_NAME with realm name in which you created the user) and adjust permissions of this realm admin user (from another browser with the master admin account). For example, the new admin realm user can delete role (that is not normal), it can do many thing on their realm you don't want it to do explicitely... (I guess)
That's all.