Keycloak: How to add a new User

Keycloak provides a powerful command-line interface ( that allows you to interact with the Keycloak server and perform various administrative tasks. In this tutorial, we’ll guide you through the process of adding a new user to your Keycloak realm using the script.

There are several options to add a new User in Keycloak. If you want to use the Web Admin Console, the following article will guide you through all the steps: Keycloak tutorial for beginners

On the other hand, if you want to use the Command Line, the following article will show how to add an user using Keycloak CLI. The command line is different depending on the version of Keycloak you are using. Let’s see both options.

Adding an User with Keycloak powered by Quarkus

To add a new User in the Quarkus Keycloak distribution you need to use the command-line interface ( .

Firstly, log in with your Admin credentials:

bin/  config credentials --server http://localhost:8080 --realm master --user admin --password admin

Then, add a new User by passing the create users command line option:

bin/ create users --realm=master -s username=test -s enabled=true -s [email protected] -s emailVerified=true --server http://localhost:8080 

Finally, set the user password:

bin/ set-password --realm=master --username test --new-password password --server http://localhost:8080 

Then, verify that the user “test” is available in your Realm:

keycloak how to add an user

Adding an User with Keycloak legacy

The legacy distribution of Keycloak contains the command line to add a new User. For example, here is how to add two users using Keycloak legacy distribution:

./ -r master -u admin -p password
./ -r oauth2-sample -u user1 -p password


This tutorial was a step-by-step guide to show you how to add a new User in Keycloak both in the Quarkus and Legacy distribution. By using the command line tools ( or you can easily automate the creation of new Users in Keycloak