Syncing realm settings betweeen DTAP

I am trying to get our DTAP environments in sync without rebuilding it every time. We have a clustered setup with a dedicated PostgreSQL DB for all 4 environments. What I would like to achieve is that we can promote the development environment (settings) to higher levels without manual clicking in the interface. The only way I could find in doing this is with Rest API calls. Is this correct? I know that there are other options, to get settings in keycloak, but they are not meant for keeping things in sync if I understand it correct or work partially.

Creating a script to maintain all settings through API is a tedious task if new versions also come into play with (probably) slightly different urls/settings as well.

any thoughts on this?

@torsten: I saw your reply in an different topic for the same issue. You mentioned a script to get things in sync. Is this private or public available? (I could not find it)

1 Like

Hi Henk yes I use the REST API for that and it works fine, The script I am using is private. But if you use the java keycloak-admin-client inside the keycloak distribution you should be fine the configuration is probably very different anyway-

Thanks for the reaction torsten. I am going to grab my automation skills to create a nice sync script that wil run over DTAP with placeholders.

I didn’t know about the keycload-admin-client. The code in git looks promising to get started.

Anybody else good other ideas/examples? (Why inventing the wheel :slight_smile: if someone else already did)

Hei Hank, I released a version of my script https://github.com/torstenzander/keycloak-rest-api-configurator-example.

Its not very well documented but helps with some nasty configuration which took me some time.
I am planning to clean it up and update it to the current version.

1 Like