I’ve been setting up my keycloak docker installation by using a shell script that calls kc_admin to import my realm.
I’ve added extra args in my docker compose:
KEYCLOAK_EXTRA_ARGS=-Dkeycloak.profile.feature.declarative_user_profile=enabled
I’ve manually enabled the user profile in my realm after which it works. But now, in order that I can rebuild my entire environment automatically, I need a way to enable the user profile as part of the realm import (JSON).
I see this section which might be relevant, but not sure how to set it up:
“org.keycloak.userprofile.UserProfileProvider”: [
{
“id”: “0c68136e-1ced-42f1-a33f-a062b4ba5e55”,
“providerId”: “declarative-user-profile”,
“subComponents”: {},
“config”: {}
}
],
And in the attributes section I have
“userProfileEnabled”: “true”
I’d be grateful if:
-
Somebody can explain how I can either enable user profile through a setting in the realm JSON which is imported, or if it can be enabled by using kc_admin.
-
Can I set the user profile attributes when I create test users as part of my setup?
kcadm.sh create users -r ${REALM_ID} -s username=${APP_USER} -s enabled=true -s “attributes.tenant_role=member” -s “attributes.tenant_id=perth” -s “firstName=Will” -s “lastName=Scarlett” -s “email=will@hood.com”
So in the above I am trying to set the firstName, lastName and email for a test user account.
Many thanks