Change NSX User Password with API
In this article, I am going to show how to change the NSX user password in different ways, but specifically using the API.
You will need your API tool, here I am going to use Postman to explore and send API requests to the NSX Manager.
But first I would like to take a moment and show 2 other ways to change the password.
- Using Alarm in NSX Manager UI.


2. Using “Using Management”

3. Using API
To begin, we will retrieve the list of NSX users using the “GET” method. For this query, we need to send the following command:
https://nsx-a.mkv.lab/api/v1/node/users

Don’t forget to provide the credentials in the “Authorization” tab. In my lab, I am using basic authentication with the Admin user. If you are using a self-signed certificate, disable the “SSL certificate verification” under “Settings.
To change the password, we need the user ID which you can obtain from the previous step. Use the following command to retrieve detailed information about the specified user:
https://nsx-a.mkv.lab/api/v1/node/users/10002
Now that we have retrieved the user ID, we can proceed to change the password by sending the old and new passwords in the request body using the ‘PUT’ method. Include the following attributes in the body of the request and send them:
{
"password": "your old password",
"old_password": "your new password"
}

If you get response code 200, it means you have successfully changed the password and the value “0” in the “last_password_change” attribute will confirm that to us.
Here is the YouTube video where I demonstrate the process:
Change the password policy
By default, the administrative password for the NSX Manager and NSX Edge appliances expires after 90 days. However, you can reset the expiration period after initial installation and configuration or set the policy to never expire (NOT recommended). To do so, you connect to the NSX CLI console and set the expiration period for between 1 and 9999 days as follow:
nsxcli> set user admin password-expiration <1 - 9999>
Or just disable password expire so the password never expires:
nsxcli> clear user admin password-expiration
Password already expired
If the password expires, you will be unable to log in and manage components. Additionally, any task or API call that requires the administrative password to execute will fail. If your password expires, see Knowledge Base article 70691 NSX-T admin password expired
