To create an NSX-T or NSX-V cloud account, you make a POST request. The request body includes the NSX-specific parameters required to create the cloud account.
Prerequisites
- Verify that all general prerequisites and prerequisites for the Automation Assembler Infrastructure as a Service (IaaS) service have been satisfied. See Prerequisites for API Use Case Examples.
- Verify that you have the following parameters for the new cloud account:
- NSX host name
- NSX user name
- NSX password
Procedure
Example: Create an NSX-V Cloud Account
This example creates an NSX-V cloud account that includes an existing vSphere cloud account.
Assign the required variables.
$ url='https://appliance.domain.com'
$ api_version='2021-07-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": "cd7d1eb4-573f-4150-8206-de3d536490ca", "ipAddress": "10.139.116.60", "name": "localhost.localdom", "hostName": "localhost.localdom", "status": "ACTIVE" },, ...
Assign the data collector ID variable.
$ data_collector_id='cd7d1eb4-573f-4150-8206-de3d536490ca'
Assign the NSX account variables.
$ nsx_host_name='nsx-manager.mycompany.local' $ nsx_username='admin' $ nsx_password='my_nsx_password'
Assign the account variables for your existing vSphere cloud account.
$ vsphere_cloud_account_id='515684ccebafde75-7f703c5265a63d87-e78aab87e9c8d5cd4cd1da1a285403f0f4e77a5240720d093e147b830b172542-23b5c527d7083675572f5099a8da0'
Create an NSX-V cloud account named demo-nsxv-account.
$ curl -X POST \ "$url/iaas/api/cloud-accounts?apiVersion=$api_version" \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $access_token" \ -d '{ "cloudAccountType": "nsxv", "privateKeyId": "'$nsx_username'", "privateKey": "'$nsx_password'", "associatedCloudAccountIds": [ "'$vsphere_cloud_account_id'" ], "cloudAccountProperties": { "hostName": "'$nsx_host_name'", "acceptSelfSignedCertificate": "true", "dcId": "'$data_collector_id'", "privateKeyId": "'$nsx_username'", "privateKey": "'$nsx_password'" }, "tags": [ { "key": "env", "value": "prod" } ], "name": "demo-nsxv-account", "description": "Example NSX cloud account description" }' | jq "."
A snippet of the response from your request shows the account ID.
...
"tags": [],
"name": "demo-nsx-account",
"id": "7b2c48362c94567559080d8f575a2",
"updatedAt": "2022-04-02",
"organizationId": "8327d53f-91ea-420a-8613-ba8f3149db95",
"orgId": "8327d53f-91ea-420a-8613-ba8f3149db95",
...