ProLiant Servers (ML,DL,SL)
1825733 Members
2949 Online
109687 Solutions
New Discussion

redfish api to change password

 
SOLVED
Go to solution
bradawk1
Trusted Contributor

redfish api to change password

We recently brought 8 racks of new servers on line and want to change the default Administator password.  All of the servers are connected to OneView.  So, I am using OneView credentials to get ilo authorized login.  That all is working.  To change the password, I did:

echo '{"UserName": "Administrator","Password":"our-new-password"}' > ilo-user
NUMUS=$(curl --insecure --silent --header "X-Auth-Token: ${iLOAuth}" --request GET ${iLOSSO}/redfish/v1/AccountService/Accounts/ | jq -r '."Members@odata.count"')
for (( i=0; i<${NUMUS}; i++ ))l do
   LNK=$(curl --insecure --silent --header "X-Auth-Token: ${iLOAuth}" --request GET ${iLOSSO}/redfish/v1/AccountService/Accounts/ | jq -r ".Members[${i}] | .\"@odata.id\"")
   if [[ "Administrator" == "$(curl --insecure --silent --header "X-Auth-Token: ${iLOAuth}" --request GET ${iLOSSO}${LNK} | jq -r '.UserName') ]]; then
      ACTID=$(echo ${LNK} | cut -d/ -f6)
      break 1
   fi
done
curl --insecure --silent --header "X-Auth-Token: ${iLOAuth}" --header "Content-Type: application/json" --data "@ilo-user" --request PATCH ${iLOSSO}/redfish/v1/AccountService/Accounts/${ACTID} | jq -r '.'

I get back:

{
  "error": {
    "code": "iLO.0.10.ExtendedInfo",
    "message": "See @Message.ExtendedInfo for more information",
    "@Message.ExtendedInfo": [
      {
        "MessageId": "iLO.2.15.UserAlreadyExist"
      }
    ]
  }
}

Can anyone see what I am doing wrong?

2 REPLIES 2
bradawk1
Trusted Contributor
Solution

Re: redfish api to change password

Figured it out.  Just changed:

echo '{"UserName": "Administrator","Password":"our-new-password"}' > ilo-user

to

echo '{"Password":"our-new-password"}' > ilo-user
Sunitha_Mod
Honored Contributor

Re: redfish api to change password

Hello @bradawk1

That's great! 

We are glad to know you were able to figure it out and we appreciate you for keeping us updated.