Created
February 9, 2024 15:42
-
-
Save aabril/35c036ef497e7cc35c17be05cdedb002 to your computer and use it in GitHub Desktop.
vrealize
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Step 1: Authenticate | |
TOKEN=$(curl -X POST \ | |
-H "Content-Type: application/json" \ | |
-d '{ | |
"username": "your_username", | |
"password": "your_password" | |
}' \ | |
https://vra.example.com/identity/api/tokens) | |
# Extract the token from the response (assuming JSON format) | |
TOKEN=$(echo $TOKEN | jq -r '.id') | |
# Step 2: Query VM Information | |
VM_NAME="your_vm_name" | |
VM_INFO=$(curl -X GET \ | |
-H "Authorization: Bearer $TOKEN" \ | |
https://vra.example.com/catalog-service/api/consumer/resources?name=$VM_NAME) | |
# Extract the IP address from the VM information (assuming JSON format) | |
IP_ADDRESS=$(echo $VM_INFO | jq -r '.content[0].resourceData.ipAddress') | |
echo "IP Address of VM $VM_NAME: $IP_ADDRESS" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment