Add a vSphere Cloud Account
To create a vSphere cloud account, you make a POST request. The request body includes the vSphere-specific parameters required to create the cloud account.
Prerequisites
- Verify that all general prerequisites have been satisfied. See Prerequisites for working with the vRealize Automation Cloud Assembly APIs.
- Verify that you have the
following parameters for the new cloud account:
- vSphere host name
- vSphere user name
- vSphere password
Procedure
Example: Create a vSphere Cloud Account
This example creates a cloud account without default cloud zones.
Assign the required variables.
$ url='https://appliance.domain.com' $ api_version='2019-01-15'
List all cloud proxies.
$ curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/data-collectors?api_version=$api_version" | jq "."
A snippet of the response from your request shows the data collector IDs.
... { "dcId": "60740040-f3cd-4694-96da-15e547242bf7", "ipAddress": "10.108.78.154", "name": "example-prod-corp-rdc", "hostName": "corp-v783-dhcp-79-85.eng.mycompany.com", "status": "ACTIVE" }, ...
Assign the data collector ID variable.
$ data_collector_id='60740040-f3cd-4694-96da-15e547242bf7'
Assign the vSphere account variables.
$ vsphere_host_name='corp-v783-dhcp-79-85.eng.mycompany.com' $ vsphere_user='[email protected]' $ vsphere_password='my_vsphere_password'
List external region IDs from your vSphere cloud account.
$ curl -X POST \ "$url/iaas/api/cloud-accounts-vsphere/region-enumeration?apiVersion=$api_version" \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $access_token" \ -d '{ "cloudAccountType": "vsphere", "username": "'$vsphere_user'", "password": "'$vsphere_password'", "hostName": "'$vsphere_host_name'", "dcid": "'$data_collector_id'", "acceptSelfSignedCertificate": "false" }' | jq "."
A snippet of the response shows the region ID to use.
... { "externalRegionIds": [ "Datacenter:datacenter-2" ] } ...
Assign the region ID variable.
vsphere_region_id='Datacenter:datacenter-2'
Create a cloud account named demo-vsphere-account without default cloud zones.
$ curl -X POST \ "$url/iaas/api/cloud-accounts?apiVersion=$api_version" \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $access_token" \ -d '{ "cloudAccountType": "vsphere", "privateKeyId": "'$vsphere_user'", "privateKey": "'$vsphere_password'", "cloudAccountProperties": { "hostName": "'$vsphere_host_name'", "acceptSelfSignedCertificate": "false", "dcId": "'$data_collector_id'", "privateKeyId": "'$vsphere_user'", "privateKey": "'$vsphere_password'" }, "regionIds": [ "'$vsphere_region_id'" ], "createDefaultZones": false, "tags": [ { "key": "env", "value": "prod" } ], "name": "demo-vsphere-account", "description": "This is a demo vSphere account without default cloud zones" }' | jq "."
A snippet of the response from your request shows the account ID.
... "tags": [], "name": "demo-vsphere-account", "id": "515684ccebafde75-7f703c5265a63d87-e78aab87e9c8d5cd4cd1da1a285403f0f4e77a5240720d093e147b830b172542-23b5c527d7083675572f5099a8da0", "updatedAt": "2019-08-02", "organizationId": "8327d53f-91ea-420a-8613-ba8f3149db95", "orgId": "8327d53f-91ea-420a-8613-ba8f3149db95", ...