top of page
  • Rajeshkumar M

vIDM Locl user password reset without email link

When resetting config admin or any local user password in VMware identity manager will trigger an email link, if in case the smtp is not working/configured we can use API call to reset the password. You can use any method to call API, here I have a sample python script which i created to reset the local admin password.



import requests
import json
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)

vidmFQDN = "vidmfqdn"
vidmUser = "admin"
vidmPass ="adminpassword"

userLogin   = "localusername"
userNewPass   = "newlocaluserpassword"


url = "https://{}/SAAS/API/1.0/REST/auth/system/login".format(vidmFQDN)
payload = '{{"username":"{}","password":"{}","issueToken":"true"}}'.format(vidmUser, vidmPass)
headers ={"accept":"application/json","Content-Type":"application/json"}

response = requests.request("POST", url, data=payload, headers=headers, verify=False)
session_token=response.json()['sessionToken']

url = "https://{}/SAAS/jersey/manager/api/scim/Users?filter=%20userName%20eq%20%22{}%22".format(vidmFQDN,userLogin)
headers = {
       'Authorization': 'Bearer '+session_token,
       'Content-Type': 'application/json',
        'accept': 'application/json'
    }

response = requests.request("GET", url, headers=headers, verify=False)
jsonObj=response.json()
userid=jsonObj['Resources'][0]['id']

url = "https://{}/SAAS/jersey/manager/api/scim/Users/{}".format(vidmFQDN,userid)
payload='{{"password":"{}"}}'.format(userNewPass)

response = requests.request("PATCH", url, data=payload, headers=headers, verify=False)
print(response)

22 views0 comments

Recent Posts

See All

vSphere Tags to NSX-T Tags

I created a simple powercli script to copy the vSphere Tags to NSX-T, it helped me to copy the NSX-T tags on the recovery VM's in non-federated/local NSX-T managers. Since SRM retain the vSphere TAG's

Copy NSX-T group's shell script

Automated copy of NSX-T local group to another NSX-T #!/bin/bash #source and destination credentials susername="username" spassword="password" dusername="username" dpassword="password" sfqdn="nsx-l-01

bottom of page