Is there an elegant way to clone a Keycloak realm with all its configurations (clients and roles) for a multitenant application?
08:54 26 Nov 2021

I'm building a multitenant application and I'm using Keycloak for authentication and authorization.

Foreach each tenant, the idea is to have a dedicated Keycloak realm. Each tenant will have exactly the same roles and clients.

I have tried to export one existing realm, use it as template and import it for new tenant. Problem: I'm facing database constraint violation due to internal id.

Question: Is there an elegant way to achieve this, having a template to create a new realm ?

keycloak