Unable to perform a data collection on a vCloud Air OnDemand endpoint with vRealize AutomationPosted: January 21, 2015
I recently signed up for the newly released vCloud Air OnDemand service and wanted to provision VMs to it using vRealize Automation (vRA). I followed the instructions found on page 13 of the IaaS Configuration for vCloud Air and vCloud Director guide, but the instructions didn’t match what I was seeing as there was no “vCloud Director API URL” link to select. https://brianragazzi.wordpress.com/2014/08/21/adding-a-vcloud-air-endpoint-to-vcloud-automation-center/ shows what the doc describes. I filed a service request with VMware and they said that vRA endpoints only works with vCloud Air subscription based plans and not the OnDemand plan. They also said that the OnDemand plan should be compatible with vRA endpoints in the upcoming months.
When I performed a data collection on the vRA vCloud Air endpoint, it would fail with the error:
Workflow ‘vCloudEndpointDataCollection’ failed with the following exception: There is an error in XML document (1, 2).
They also said that they were having issues with the API that may have been what was preventing me from working through the instructions at Log In and Receive Access Token. I’ll go ahead and post what I performed even though it didn’t work. Maybe once the issue with the API gets resolved it will work or maybe it’s not related and I can update this post in the future.
The first thing we need to convert your login credentials into a Base64 encoded string. The login credentials will be in the form of user@domain:password. If you’re on a Linux system, you can convert this into a Base64 string by running:
$ echo ‘email@example.com:password’ | base64
You can also go to https://www.base64encode.org/ to perform the encoding.
Now we need to make a call to the login URL at https://iam.vchs.vmware.com/api/iam/login:
curl -I -H 'Accept: application/xml;version=5.7' \ -H 'Content-Type: application/xml;version=5.7' \ -H 'Authorization: Basic dXNlcm5hbWVAZXhhbXBsZS5jb206cGFzc3dvcmQK' \ -X POST https://iam.vchs.vmware.com/api/iam/login
Make sure to use the -I parameter or you won’t be able to see the authorization token that is sent back. You should get something back like this:
HTTP/1.1 201 Created
Date: Thu, 22 Jan 2015 02:42:10 GMT
Content-Type: application/xml; version=5.7
Set-Cookie: ROUTEID=.186; path=/; Domain=.vmware.com
The long string after vchs-authorization is our token. Let’s go ahead and assign it to a variable since it’s so long and you need to send it in each subsequent request.
Now we will follow the example and list out our current service plans:
curl -I -H 'Accept: application/xml;version=5.7' \ -H "Authorization: Bearer $token" \ https://iam.vchs.vmware.com/api/sc/plans
Note that now we have a new header with our token. I received the following response:
HTTP/1.1 302 Found
Date: Thu, 22 Jan 2015 03:37:45 GMT
Server: Apache/2.2.15 (CentOS)
Content-Type: text/html; charset=iso-8859-1
302 is a temporary redirect and is redirecting to https://us-california-1-3.vchs.vmware.com/api/sc/plans. So I changed my request to:
curl -I -H 'Accept: application/xml;version=5.7' \ -H "Authorization: Bearer $token" \ https://us-california-1-3.vchs.vmware.com/api/sc/plans
HTTP/1.1 405 Method Not Allowed
Date: Thu, 22 Jan 2015 03:44:22 GMT
Via: 1.1 us-california-1-3.vchs.vmware.com
Here is where I stopped as I didn’t want to put more effort into it if the API service is having issues. This is the first time I’ve looked at the vCloud Air API so maybe I’m missing something. I’ll update this post when I have a solution or if someone knows the solution, please leave it in the comments. Thanks.