# Update realm settings from json file using kcadm.sh (script)

**URL:** <https://forum.keycloak.org/t/update-realm-settings-from-json-file-using-kcadm-sh-script/17184>\
**Category:** Getting advice\
**Created:** [September 1, 2022, 8:44am UTC](https://forum.keycloak.org/t/update-realm-settings-from-json-file-using-kcadm-sh-script/17184 "2022-09-01T08:44:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![amir](https://avatars.discourse-cdn.com/v4/letter/a/c37758/32.png) [@amir](https://forum.keycloak.org/u/amir)\
**Post date:** [September 1, 2022, 8:44am UTC](https://forum.keycloak.org/t/update-realm-settings-from-json-file-using-kcadm-sh-script/17184/1 "2022-09-01T08:44:48Z")

</div>

Hi all

today, when creating a new server we are running a script that is responsible for the following things:  
create a master admin user  
import a new realm named devRealm from a realm.json file  
create a new user named user1 for devRealm  
set a password for that user and set role and group

this is the script:

#!/bin/sh  
export PATH=$PATH:/opt/jboss/keycloak/bin/  
kcadm.sh config credentials --server [http://localhost:8080/auth](http://localhost:8080/auth) --realm master --user admin --password 12345  
kcadm.sh create realms -s realm=devRealm -s enabled=true -f realm.json  
USER\_ID=$(kcadm.sh create users -r devRealm -s username=user1 -s enabled=true 2\>&1 | grep -Ewo ‘[[:xdigit:]]{8}(-[[:xdigit:]]{4}){3}-[[:xdigit:]]{12}’)  
echo USER\_ID=$USER\_ID  
kcadm.sh set-password -r devRealm --username user1 --new-password 12345  
kcadm.sh add-roles --uusername user1 --rolename Administrators -r devRealm  
kcadm.sh update users/$USER\_ID/groups/775edba1-94cc-4d2a-b25f-490df79f55fe -r devRealm -n

Now, from time to time we are doing some changes to the realm.json fille (like adding new groups, roles, mapper, etc.)

Is there a way to run a script like this one to import the new realm.json file into an **EXISTING** KC ?

we don’t want to manually make those changes every time. we just want to update the json file in the machine and run a script to import it.

Any help would be applicated
