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 *
Pleas have a look in this command
/bin/add-user.sh -r myrealm -u admin -p
here you are trying to run a shell script which will create a user admin
with some password
under realm myrealm
.
So its mandatory myrealm
realm should exist before you are going to create a user under it.
If this is not working try to create a user under master
realm which is default realm exist after keycloak installation.
Id you are not aware how to create realm ,here are some of the admin-cli
and curl
commands to do so
How to create realm with the help of admin-cli
/opt/keycloak/bin/kcadm.sh create realms -s realm= -s id="" -s enabled=true -s
How to create realm with the help of curl command
curl -v :/auth/admin/realms -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" --data '{"realm":"Realm-name","id":"Realm-id","enabled":"true"}' -k