VMware vRA CLI Troubleshooting Guide
This guide helps you diagnose and resolve common issues when using the VMware vRA CLI tool.
General Troubleshooting Steps
Enable Verbose Mode
Always start troubleshooting with verbose mode to see detailed HTTP request/response information:
Example:
vmware-vra --verbose auth login
vmware-vra --verbose catalog list
vmware-vra --verbose deployment export-all
Check CLI Version and Environment
# Check CLI version
vmware-vra --version
# Check current configuration
vmware-vra config show
# Check authentication status
vmware-vra auth status
Verify Network Connectivity
# Test basic connectivity to vRA server
curl -k https://your-vra-server.com/health
# Test with authentication (replace with your actual token)
curl -k -H "Authorization: Bearer your-token" https://your-vra-server.com/catalog/api/items
Authentication Issues
Issue: "No valid authentication token found"
Symptoms:
Solutions:
-
Re-authenticate:
-
Check stored tokens:
-
Clear and re-authenticate:
Issue: "Authentication failed: 401 Unauthorized"
Symptoms:
Possible Causes and Solutions:
- Invalid credentials:
- Verify username and password
-
Check if account is locked or disabled
-
Wrong domain (for multiple identity sources):
-
Wrong tenant:
-
Wrong vRA URL:
Issue: "SSL Certificate Verification Failed"
Symptoms:
Solutions:
-
Disable SSL verification (NOT recommended for production):
-
Add certificate to system trust store (recommended):
- Download the vRA certificate
- Add to your system's certificate store
-
Restart CLI
-
Use proper certificate setup:
- Ensure vRA has valid SSL certificate
- Verify certificate chain is complete
Issue: "Token expired" errors during operations
Symptoms:
Solutions:
-
Refresh token manually:
-
Re-authenticate if refresh fails:
-
Check token expiration:
Permission and Authorization Issues
Issue: "403 Forbidden" on specific operations
Symptoms:
Required Roles by Operation:
Operation | Minimum Required Role |
---|---|
List catalog items | Service Catalog User |
Request catalog items | Service Catalog User + Project access |
List all deployments | Service Catalog User |
List project deployments | Project Member |
Delete deployments | Project Administrator |
Export all deployments | Service Catalog User (system-wide) or Project Administrator (project-specific) |
Tag management | Depends on resource - see below |
Tag Management Permissions: - List tags: Service Catalog User - Create/Delete tags: Organization Administrator - Assign/Remove tags: Resource owner or Project Administrator
Solutions:
- Check your roles in vRA:
- Log into vRA web interface
- Check assigned roles in user profile
-
Contact administrator for role assignment
-
Use project-specific operations:
-
Request appropriate permissions:
- Contact your vRA administrator
- Request minimum required roles for your use case
Network and Connectivity Issues
Issue: Connection timeouts
Symptoms:
Solutions:
-
Increase timeout:
-
Check network connectivity:
-
Check proxy settings:
Issue: DNS resolution failures
Symptoms:
Solutions:
-
Verify DNS resolution:
-
Use IP address instead:
-
Check /etc/hosts file:
Export-Specific Issues
Issue: Export command hangs or times out
Symptoms:
# Command appears to hang indefinitely
vmware-vra deployment export-all
# No output for extended period
Solutions:
-
Use project filtering to reduce scope:
-
Disable resource details (faster):
-
Increase timeout:
-
Check system resources:
Issue: "No space left on device" during export
Symptoms:
Solutions:
-
Check available space:
-
Use external storage:
-
Clean up existing exports:
-
Export in smaller chunks:
Issue: Export creates empty or incomplete files
Symptoms: - Export completes but files are empty - Missing expected deployments in export
Solutions:
-
Verify permissions:
-
Check export summary:
-
Enable verbose mode:
-
Validate export files:
Configuration Issues
Issue: "Config file not found" or configuration not persisting
Symptoms:
Solutions:
-
Check config file location:
-
Create config directory manually:
-
Set configuration manually:
-
Check file permissions:
Issue: Environment variables not being recognized
Symptoms: - Environment variables don't override config - Settings revert to defaults
Solutions:
-
Verify environment variable names:
-
Check variable values:
-
Test with explicit values:
Data and JSON Issues
Issue: "JSON decode error" when parsing responses
Symptoms:
Solutions:
-
Check vRA server status:
-
Verify API endpoints:
-
Check for HTML error pages:
-
Verify vRA version compatibility:
- Check if your vRA version is supported
- Some API endpoints may differ between versions
Issue: Unicode or character encoding errors
Symptoms:
Solutions:
-
Check system locale:
-
Set UTF-8 environment:
-
Check deployment/catalog item names:
- Some special characters may cause issues
- Contact administrator to fix problematic names
Performance Issues
Issue: Slow CLI operations
Symptoms: - Commands take much longer than expected - Large environments cause timeouts
Solutions:
-
Use pagination options:
-
Increase page sizes:
-
Filter by project:
-
Avoid resource details when not needed:
Platform-Specific Issues
Windows Issues
Issue: SSL errors on Windows
Solution:
Issue: Path issues with PowerShell
Solution:
# Use forward slashes or escape backslashes
vmware-vra deployment export-all --output-dir "./exports"
# or
vmware-vra deployment export-all --output-dir "C:\\backup\\exports"
macOS Issues
Issue: SSL certificate verification on macOS
Solution:
# Add certificate to keychain
security add-trusted-cert -d -r trustRoot -k ~/Library/Keychains/login.keychain certificate.crt
Linux Issues
Issue: Missing dependencies
Solution:
# Install required packages (Ubuntu/Debian)
sudo apt-get update
sudo apt-get install python3-pip curl jq
# Install required packages (RHEL/CentOS)
sudo yum install python3-pip curl jq
Debugging Tools and Techniques
HTTP Traffic Analysis
Use tools to analyze HTTP traffic:
# Using mitmproxy (requires setup)
mitmdump -s script.py
# Using tcpdump (requires root)
sudo tcpdump -i any port 443
# Using curl to test specific endpoints
curl -k -H "Authorization: Bearer token" \
"https://vra.example.com/catalog/api/items" -v
Log Analysis
Enable comprehensive logging:
# Create log directory
mkdir -p ~/.cache/vmware-vra-cli/logs
# Enable debug logging (if supported by CLI)
export VRA_DEBUG=true
vmware-vra --verbose catalog list 2>&1 | tee debug.log
JSON Response Analysis
Analyze responses for debugging:
# Pretty print JSON responses
vmware-vra --format json catalog list | jq .
# Filter specific fields
vmware-vra --format json deployment list | jq '.[].status' | sort | uniq -c
# Find problematic entries
vmware-vra --format json catalog list | jq '.[] | select(.name | contains("special-chars"))'
Getting Help
CLI Help
# Global help
vmware-vra --help
# Command-specific help
vmware-vra deployment --help
vmware-vra deployment export-all --help
# Show all available commands
vmware-vra --help | grep -A 100 "Commands:"
Collecting Diagnostic Information
When reporting issues, collect this information:
#!/bin/bash
# diagnostic-info.sh
echo "=== VMware vRA CLI Diagnostic Information ==="
echo "Date: $(date)"
echo "CLI Version: $(vmware-vra --version)"
echo "Platform: $(uname -a)"
echo "Python Version: $(python --version 2>&1)"
echo -e "\n=== Configuration ==="
vmware-vra config show
echo -e "\n=== Authentication Status ==="
vmware-vra auth status
echo -e "\n=== Network Connectivity ==="
ping -c 3 your-vra-server.com 2>/dev/null || echo "Ping failed"
echo -e "\n=== Environment Variables ==="
env | grep VRA_ || echo "No VRA_ environment variables set"
echo -e "\n=== Recent Errors (if log file exists) ==="
if [ -f debug.log ]; then
tail -20 debug.log
else
echo "No debug.log file found"
fi
Common Error Patterns
Error Pattern | Likely Cause | Quick Fix |
---|---|---|
SSL: CERTIFICATE_VERIFY_FAILED |
SSL certificate issues | Set verify_ssl false temporarily |
401 Unauthorized |
Authentication expired | Run vmware-vra auth refresh |
403 Forbidden |
Insufficient permissions | Check user roles in vRA |
Connection timeout |
Network issues | Increase timeout or check connectivity |
JSON decode error |
Server returning HTML/error page | Check vRA server status |
No space left on device |
Disk full | Clean up or use different output directory |
Command not found |
CLI not installed properly | Reinstall CLI |
Prevention Tips
Regular Maintenance
#!/bin/bash
# vra-cli-maintenance.sh
# Test authentication
vmware-vra auth status
# Test basic connectivity
vmware-vra catalog list --first-page-only >/dev/null && echo "✓ API accessible" || echo "✗ API issues"
# Check disk space for exports
df -h . | grep -v "Avail" | awk '{if($5 > 80) print "⚠ Disk space low: "$5" used"}'
# Clean old exports
find ./exports -name "*.json" -mtime +7 -exec echo "Old export file: {}" \;
Configuration Validation
#!/bin/bash
# validate-config.sh
echo "Validating vRA CLI configuration..."
# Check required config
CONFIG_ITEMS=("api_url" "tenant")
for item in "${CONFIG_ITEMS[@]}"; do
VALUE=$(vmware-vra config show --format json 2>/dev/null | jq -r ".$item")
if [ "$VALUE" = "null" ] || [ -z "$VALUE" ]; then
echo "⚠ Missing required config: $item"
else
echo "✓ $item configured"
fi
done
# Test authentication
if vmware-vra auth status | grep -q "Authenticated"; then
echo "✓ Authentication valid"
else
echo "⚠ Authentication required"
fi
echo "Configuration validation complete."
This comprehensive troubleshooting guide should help resolve most issues encountered when using the VMware vRA CLI tool.