Add a VMware Managed Cloud Account

To create a VMware Managed Cloud (VMC) account, you make a POST request. The request body includes the VMC-specific parameters required to create the cloud account.

Prerequisites

Procedure

  1. 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 "."
  2. Examine the response and assign the data collector variable.
    data_collector_id='<your_datacollector_id>'
  3. Assign the VMC account variables.
    vmc_api_token='<your_vmc_api_token>'
    vmc_sddc_name='<your_vmc_sddc_name>'
    vmc_vcenter_private_ip='<your_vcenter_private_ip>'
    vmc_nsx_manager_ip='<your_nsx_manager_ip>'
    vmc_vcenter_username='<your_vcenter_username>'
    vmc_vcenter_password='<your_vcenter_password>'
    vmc_vcenter_datacenter_id='<your_datacenter_id>'
  4. Submit a request to create a VMC account.
    curl -X POST \
      "$url/iaas/api/cloud-accounts?apiVersion=$api_version" \
      -H "Authorization: Bearer $access_token" \
      -H 'Content-Type: application/json' \
      -d '{
        "name": "vmc-endpoint",
        "description": "VMC cloud account",   
        "cloudAccountType": "vmc",  
        "privateKeyId": "'"$vmc_vcenter_username"'",
        "privateKey": "'"$vmc_vcenter_password"'",
        "cloudAccountProperties": {
            "sddcId": "'"$vmc_sddc_name"'",
            "apiKey": "'"$vmc_api_token"'",       
            "hostName": "'"$vmc_vcenter_private_ip"'",
            "nsxHostName": "'"$vmc_nsx_manager_ip"'",       
            "dcId": "'"$vmc_data_collector_id"'",
            "acceptSelfSignedCertificate": "false"       
        },
        "regionIds": [
            "'"$vmc_vcenter_datacenter_id"'"
        ]
    }' | jq "."
  5. To obtain the VMC account ID, examine the response.
  6. Assign the VMC account ID variable.
    vmc_cloud_id='<your_vmc_cloud_id>'
  7. List all cloud accounts.
    curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/cloud-accounts?apiVersion=$api_version"  | jq "."
  8. Examine the response and verify that the name and ID of the VMC account you created is listed.

Example: Create a VMC 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 VMC account variables.

$ vmc_data_collector_id=a1235a7f-d49f-4365-8ed9-2d7d0805e4bc
$ vmc_api_token=ab392fba-32a8-49a5-a084-d422fa32c5b8
$ vmc_sddc_name=MYCOM-PRD-NSXT-M7GA-052019
$ vmc_vcenter_private_ip=10.70.57.196
$ vmc_nsx_manager_ip=10.70.57.131
$ [email protected]
$ vmc_vcenter_password=aBcqCW+m4+XEQg7
$ vmc_vcenter_datacenter_id=Datacenter:datacenter-1

Create a VMC account named demo-vmc-account.

$ curl -X POST \
  "$url/iaas/api/cloud-accounts?apiVersion=$api_version" \
  -H "Authorization: Bearer $access_token" \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "demo-vmc-account",
    "description": "VMC cloud account",   
    "cloudAccountType": "vmc",  
    "privateKeyId": "'"$vmc_vcenter_username"'",
    "privateKey": "'"$vmc_vcenter_password"'",
    "cloudAccountProperties": {
        "sddcId": "'"$vmc_sddc_name"'",
        "apiKey": "'"$vmc_api_token"'",       
        "hostName": "'"$vmc_vcenter_private_ip"'",
        "nsxHostName": "'"$vmc_nsx_manager_ip"'",       
        "dcId": "'"$vmc_data_collector_id"'",
        "acceptSelfSignedCertificate": "false"       
    },
    "regionIds": [
        "'"$vmc_vcenter_datacenter_id"'"
    ]
}' | jq "."

A snippet of the response from your request shows the account ID.

...            
      "tags": [],    
      "name": "demo-vmc-account",
      "description": "VMC cloud account",
      "id": "e2188ee5e1da675590a4d60dfaf2",
      "updatedAt": "2021-08-02",
      "organizationId": "6ab4d969-1f2a-4db8-a712-78d34239d1d2",
      "orgId": "6ab4d969-1f2a-4db8-a712-78d34239d1d2",
...