Export multiple realms

I have a keycloak instance with over 2000 realms in it. My requirement is, I need to export and import some realms from it to a new instance. But the keycloak documentation mentions exporting of either a specific realm or all the realms into a single file or into a directory. Is there any way I can export few realms of my choice in one go.

The document which I referred was https://www.keycloak.org/docs/latest/server_admin/index.html#_export_import

Hi there,
You can always export them all into a single file or directory. Cherry pick the one that you need and get them imported back into the new instance.

Export of the realms won’t delete them from the oginal instance.

Regards,
M1pl

Sure. Thank you @m1pl for the suggestion.

Hi, you can use the kcadmin CLI or the ADMIN API to list your realm in a bash script and do a bulk import thanks to standalone.sh in the same script

@m1pl and @M3lkior Thank you so much for your help on export. Now during the directory import, it is too slow. I have raised this Slow import of realms and users from directory, during startup - #2 by upendra . Any help would help greatly. Thank you.

1 Like