To create a Microsoft Azure cloud account, you make a POST request. The request body includes parameters specific to Microsoft Azure that are required to create the cloud account.

As an alternative to using the cloud-accounts API call, you can use a cloud-accounts-azure API call that creates a Microsoft Azure cloud account with fewer input parameters.

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:
    • Microsoft Azure subscription ID
    • Microsoft Azure tenant ID
    • Microsoft Azure client application ID
    • Microsoft Azure client application secret key

Procedure

  1. Assign the Microsoft Azure account variables.
    azure_subscription_id='<your_azure_subscription_id>'
    azure_tenant_id='<your_azure_tenant_id>'
    azure_client_application_id='<your_azure_client_application_id>'
    azure_client_application_secret_key='<your_azure_client_application_secret_key>'
  2. Submit a request to create a Microsoft Azure cloud account with 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":"azure",
        "privateKeyId":"'$azure_client_application_id'",
        "privateKey":"'$azure_client_application_secret_key'",
        "cloudAccountProperties": {
          "userLink":"'$azure_subscription_id'",
          "azureTenantId":"'$azure_tenant_id'"
        },
        "regionIds":["<your_region_id>"],
        "createDefaultZones":true,
        "name":"<your_azure_cloud_account>",
        "description": "This is a demo Azure cloud account",
      }' | jq "."
  3. (Optional) Submit a request to create a Microsoft Azure cloud account with the cloud-accounts-azure API call.
    curl -X POST \
      "$url/iaas/api/cloud-accounts-azure?apiVersion=$api_version" \
      -H 'Content-Type: application/json' \
      -H "Authorization: Bearer $access_token" \
      -d '{
        "name":"<your_azure_cloud_account>",
        "description": "This is a demo Azure cloud account",
        "subscriptionId": "'$azure_subscription_id'",
        "tenantId": "'$azure_tenant_id'",
        "clientApplicationId": "'$azure_client_application_id'",
        "clientApplicationSecretKey": "'$azure_client_application_secret_key'",
        "regionIds": [ "<your_region_id1>", "<your_region_id2>" ],
        "createDefaultZones": true,
        "tags": [ { "key": "env", "value": "dev" } ]
      }' | jq "."
  4. List all cloud accounts.
    curl -X GET $url/iaas/api/cloud-accounts?apiVersion=$api_version -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" | jq "."
  5. Examine the response and verify that the name and ID of the Microsoft Azure cloud account you created is listed.

Example: Create a Microsoft Azure Cloud Account

Assign the required variables.

Note: If your organization uses an API service that is hosted outside of the United States, your URL variable must include a country abbreviation. See Regional Endpoints for VMware Aria Automation APIs.
$ url='https://api.mgmt.cloud.vmware.com'
$ api_version='2021-07-15'
$ azure_subscription_id='r1e31415-4a08-4072-be4a-19de37d12345'
$ azure_tenant_id='s39138ca-3abc-4b4a-a4d6-cd92d9dd62f0'
$ azure_client_application_id='te21wxyz-b183-42ac-cd84-3c4a2459b9a9'
$ azure_client_application_secret_key='udv6lY8MwpP5ABCDfSztP3ABCDEaLMNOPQRmDEUeiI0='

Create a cloud account named demo-azure-account.

$ curl -X POST \
  "$url/iaas/api/cloud-accounts?apiVersion=$api_version" \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $access_token" \
  -d '{
    "cloudAccountType":"azure",
    "privateKeyId":"'$azure_client_application_id'",
    "privateKey":"'$azure_client_application_secret_key'",
    "cloudAccountProperties": {
      "userLink":"'$azure_subscription_id'",
      "azureTenantId":"'$azure_tenant_id'"
    },
    "regionIds":["eastus"],
    "createDefaultZones":true,
    "name": "demo-azure-account",
    "description": "This is a demo Azure cloud account",
  }' | jq "."

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

...      
"tags": [],
"name": "demo-azure-account",
"id": "c8c3c9bfdb449475-7f703c5265a63d87-f8e705d89b2569e1aac66c6d00bf4fc7ef4b1c44100f0e944af31eb8ba3d2a5a-f4226a20b65c4675574bc5fbff6c0",
"updatedAt": "2022-04-02",
"organizationId": "8327d53f-91ea-420a-8613-ba8f3149db95",
...