How to clone a realm?

Found this post ( Is there an elegant way to clone a Keycloak realm with all its configurations (clients and roles) for a multitenant application? - Stack Overflow) saying the export the realm and remove the ids from the json file but wondering if there’s a simpler way to clone a realm with clients and roles but with a different realm name?

Keycloak version I am using is 19.0.3

Exporting realms from the admin UI or the command line are the recommended ways to do it. Here is a guide for the command line Importing and Exporting Realms - Keycloak

Also, many people are using this GitHub - adorsys/keycloak-config-cli: Import YAML/JSON-formatted configuration files into Keycloak - Configuration as Code for Keycloak. as it allows you to make incremental changes, and just applies the diff.

1 Like

Thanks @xgp, you are awesome