cancel
Showing results for 
Search instead for 
Did you mean: 

Change expired default root/admin password with RESTAPI

andrescolo
Nimbostratus
Nimbostratus

Hi,

Im setting a new F5 VE 15.1 big ip, and first i want to change expired passwords. ACtually i can only do it from the brownser.

Im have been testing the REST API like, but i cant make it work.

 

$secpasswd = ConvertTo-SecureString 'default' -AsPlainText -Force

$mycreds = New-Object System.Management.Automation.PSCredential 'root', $secpasswd

 

$Props = @{

    Uri                     = "https://10.21.65.11/mgmt/tm/auth/root "

    Credential              = $mycreds

    ContentType             = "application/json"

    Body                    = $payload

    Method                  = "Patch"

    SkipCertificateCheck    = $True

    Verbose                 = $True

}

invoke-restmethod @Props

 

 

VERBOSE: PATCH https://10.21.65.11/mgmt/tm/auth/root with 64-byte payload

payload is:

{

  "oldpassword": "default",

  "newpassword": "example1234"

}

 

VERBOSE: received 165-byte response of content type application/json

invoke-restmethod : {"code":401,"message":"Authentication failed: Password expired. Update password via /mgmt/shared/authz/users.","restOperationId":6489074,"kind":":resterrorresponse"

 

So then i try: (with same credentials an payload)

 

VERBOSE: PATCH https://10.21.65.11/mgmt/shared/authz/users/admin with 64-byte payload

VERBOSE: received 381-byte response of content type text/html

invoke-restmethod :

401 Unauthorized

Unauthorized

 

 

1 REPLY 1

Satoshi_Toyosa1
F5 Employee
F5 Employee

Try changing the admin password first by sending a PATCH request with "oldpassword" and "password" (not "newpassword") properties: e.g.,

curl -sku admin:admin https://<mgmtIP>/mgmt/shared/authz/users/admin \ -X PATCH -H "Content-type: application/json" \ -d '{"oldPassword":"admin", "password":"superuser1000"}'

This action changes the admin password to "superuser1000". It also changes the root password to "superuser1000". See also K10612010.