Wednesday, July 13, 2022

GET VRA Tokens

We will get the refresh and access tokens for VRA , I am following the below page but with a small adjustment

https://vdc-download.vmware.com/vmwb-repository/dcr-public/97d1d46c-8846-4c12-85a8-5655d1189825/3873335e-1ec6-4bac-a9c2-2f62636ce19f/GUID-AC1E4407-6139-412A-B4AA-1F102942EA94.html  


Step number zero :-) . you will need to have a linux VM that can reach to VRA on port 443

1. Define your variables

identity_service_url='https://<vRA-HOSTNAME>'
username='<your_username>'
password='<your_password>'

2. Execute the below command
api_token=`curl -k -X POST \
  "$identity_service_url/csp/gateway/am/api/login?access_token" \
  -H 'Content-Type: application/json' \
  -d '{
  "username": "'"$username"'",
  "password": "'"$password"'"
}' | jq -r .refresh_token`

3. Get the refresh token
echo $api_token

to get the access token:

1. Define your variables
identity_service_url='https://<vRA-HOSTNAME>'
username='<your_username>'
password='<your_password>'

2. Execute the below command
access_token=`curl -k -X POST \
  "$identity_service_url/iaas/api/login" \
  -H 'Content-Type: application/json' \
  -s \
  -d '{
  "refreshToken": "'"$api_token"'"
}' | jq -r .token`

3. Get the access token
echo $access_token

No comments:

Post a Comment

NSX-T (local log in) with VIDM integration

We will explain how to log in with a local account to your NSX-T which integrated with VIDM. We integrated our NSX-T into the VIDM. We had a...