Do we have any other way to create initial user apart from setting up environment variable or from the administration console

Is there any other way to setup admin user credentials when using command line.
basically i am aware of two possible ways documented in the keycloak documentation.

  • By setting up KEYCLOAK_ADMIN and KEYCLOAK_ADMIN_PASSWORD
  • By administration console when the application starts through the admin console screen.

But the first option password will be shown in environment variable that is much of a security concern.

And the second option one need to enter in the actual server and the url is accessible via localhost only.

So, is there any other way to set it up using admin-cli or any rest api???