How to update keycloak user's attributes by kcadm.sh?

Viewed 819

I tried to update user's attribute using kcadm.sh but it fails.

# keycloak-12.0.1/bin/kcadm.sh update users/10777a97-5f47-4784-99e0-3251b581262d -r apps -s 'addributes.guid=["newvalue"]'
HTTP error - 400 Bad Request

I'm following the below guide, and it looks the above command should work. https://github.com/keycloak/keycloak-documentation/blob/master/server_admin/topics/admin-cli.adoc#updating-a-group

I can update the other fields:

# keycloak-12.0.1/bin/kcadm.sh update users/10777a97-5f47-4784-99e0-3251b581262d -r apps -s "firstName=user3" -o
{
  "id" : "10777a97-5f47-4784-99e0-3251b581262d",
  "createdTimestamp" : 1609862570377,
  "username" : "user3",
  "enabled" : true,
  "totp" : false,
  "emailVerified" : false,
  "firstName" : "user3",
  "attributes" : {
    "guid" : [ "oldvalue" ]
  },
  "disableableCredentialTypes" : [ ],
  "requiredActions" : [ ],
  "notBefore" : 0,
  "access" : {
    "manageGroupMembership" : true,
    "view" : true,
    "mapRoles" : true,
    "impersonate" : true,
    "manage" : true
  }
}

Did I miss something?

1 Answers

You need to the following:

keycloak-12.0.1/bin/kcadm.sh update users/10777a97-5f47-4784-99e0-3251b581262d -r apps -s 'attributes={"guid":["q"]}'
Related