[keycloak-user] kcadm - LDAP adding a variable as part of script

Jamie McDowell jambo_mcd at yahoo.co.uk
Wed Aug 1 11:24:12 EDT 2018


Hi,
I am trying to add a variable as part of my kcadm. As an example this is for adding the connectionURL from an environment variable. Version is 3.4.3
my ". ldapenv" has all the environment information and this is ran first of all as part of my script.

echo "Set the environment...". ldap.env

echo "Creating LDAP provider for users..."/opt/jboss/keycloak/bin/kcadm.sh create components \--server $KEYCLOAK_SERVER \--user $KEYCLOAK_USER \--password $KEYCLOAK_PASSWORD \-r $NEW_REALM \-s id=$LDAP_USER_ID \-s name=ldap-users \-s providerId=ldap \-s providerType=org.keycloak.storage.UserStorageProvider \-s parentId=$REALM_ID \-s 'config.priority=["0"]' \-s 'config.fullSyncPeriod=["-1"]' \-s 'config.changedSyncPeriod=["-1"]' \-s 'config.cachePolicy=["DEFAULT"]' \-s 'config.evictionDay=[]' \-s 'config.evictionHour=[]' \-s 'config.evictionMinute=[]' \-s 'config.maxLifespan=[]' \-s 'config.batchSizeForSync=["1000"]' \-s 'config.editMode=["WRITABLE"]' \-s 'config.syncRegistrations=["true"]' \-s 'config.vendor=["other"]' \-s 'config.usernameLDAPAttribute=["mail"]' \-s 'config.rdnLDAPAttribute=["uid"]' \-s 'config.uuidLDAPAttribute=["entryUUID"]' \-s 'config.userObjectClasses=["inetOrgPerson, organizationalPerson, top, person"]' \-s 'config."connectionUrl"=['$LDAPHOST']' 
When the script has completed and log into keycloak to check the settings, under connectionURL this shows $LDAPHOST when i should be expecting something like ldap://example.com (this is what is set in my ldap.env)
I know when i hard-code the ldaphost this works fine.
I have tried various ways using single quotations, double quotations but just cant seem to get this to populate with the correct output.
Regards,
Jamie


More information about the keycloak-user mailing list