[keycloak-user] how to clone a realm?

Madhu kkcmadhu at yahoo.com
Fri Jul 6 05:59:17 EDT 2018


I removed all the IDs and let keycloak auto generated the IDs, it worked.. but my concern now is for child entities,i.e. the one's with "container-id" tags, for those we still need to define/generate unique keys manually..Madhu
Sent from Yahoo Mail on Android 
 
  On Thu, 5 Jul 2018 at 3:07 PM, Hongliu Zou<hongliu at bondlinc.com> wrote:   Hi Madhu
I am facing same issue when try to duplicate realm from file by two simple steps below- Export from keyclock A to a file- Import realm from the file to keycloak B
Error from keyclock log is 
org.h2.jdbc.JdbcSQLException: Unique index or primary key violation

After manually change all ids to different value in the file, I can import now. Maybe write a script to process id to plus 1 for all ids is better. It looks like export function of keyclock to handle this case is better. Need input from keycloak experts. :)
ThanksHongliu 
On Thu, Jul 5, 2018 at 3:31 PM, Sebastian Laskawiec <slaskawi at redhat.com> wrote:

Hey Madhu,

How about using import/export functionality [1] (with some manual editing
or sed/awk magic?

Thanks,
Sebastian

[1]
https://www.keycloak.org/docs/ latest/server_admin/index. html#_export_import

On Thu, Jul 5, 2018 at 9:06 AM Madhu <kkcmadhu at yahoo.com> wrote:

>
>  Hi,
> I am using keycloak for a multi tenant/multi realm scenario.
> In all my realms the clients/roles/password
> policies/groups/ authentication/token settings etc are same.
> So my idea is to create a template realm and clone it to a new realm every
> time i want to provision a new tenant.
> I tried using the import/export option, but was not successful. I even
> tried remvoign all the ids /container id fields from the exported json and
> changed the realm namesand was unsuccessful again.
> Any idea how to clone a realm?
> Looks like import/export was built for replicating/duplicating the data in
> another keycloak/database instance, and not suitable for cloning /creating
> a new realm.
> Any idea how i can create a new realm with defined set of clients, user
> policies, mappers, authentication settings, flows, token settings and roles?
> Regards,Madhu
> ______________________________ _________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/ mailman/listinfo/keycloak-user
>
______________________________ _________________
keycloak-user mailing list
keycloak-user at lists.jboss.org
https://lists.jboss.org/ mailman/listinfo/keycloak-user


  


More information about the keycloak-user mailing list