Change expired default root/admin password with RESTAPI
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