Keycloak.x Admin Account

We are evaluating Keycloak.x for a new project. Installation is a breeze. However we have difficulties to activate the server (adding the initial admin user) because we don’t have browser access to localhost. Even using ngrok doesn’t work - http://localhost:8080/auth times out. Is there a command line version to add the user (similarly to add-user-keycloak.sh). We played with kcadm.sh but there’s just not enough documentation.

Thanks…

Hi @gfreund

you can use this command to add a new global admin use in the shell:

.../bin/add-user-keycloak.sh -r master -u <username> -p <password> as described in a number of available documentations as well as in the original keycloak manual Link

and start the service by using this command:

.../bin/standalone.sh -b 0.0.0.0 -bmanagement 0.0.0.0

Continuing the discussion from Keycloak.x Admin Account:

Thanks @xkey,
much appreciated. We’ve done this with regular keycloak (also I didn’t know the standalone.sh switches - thanks, very helpful).

However now how do I get the same thing working for keycloak.x? There is no add-user-keycloak.sh. The utilities provided are kc.sh, kcadm.sh and kcreg.sh with little documentation.

~G

This is only available for wildfly you could however make a node script to add users like so: quick keycloak-nodejs-script · GitHub

@gfreund since keycloak.x is running on top of quarkus, you can use below property to make keycloak x instance available from outside the Linux box.

quarkus.http.host=0.0.0.0

Note: This will be added in the keycloak.property fil present in conf directory.

Let me know if this solution works for you.

Once you had set the initial admin user you can remove it later.

@gfreund

You can use environment variable to do that

$ export KEYCLOAK_ADMIN=admin; export KEYCLOAK_ADMIN_PASSWORD=change_me
$ /opt/jboss/keycloak/bin/kc.sh start-dev