Create Azure Recovery Services vault using REST API

The steps to create an Azure Recovery Services vault using REST API are outlined in create vault REST API documentation. Let's use this document as a reference to create a vault called "testVault" in "West US".

To create or update an Azure Recovery Services vault, use the following PUT operation.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}?api-version=2016-06-01

Create a request

To create the PUT request, the {subscription-id} parameter is required. If you have multiple subscriptions, see Working with multiple subscriptions. You define a {resourceGroupName} and {vaultName} for your resources, along with the api-version parameter. This article uses api-version=2016-06-01.

The following headers are required:

Request header Description
Content-Type: Required. Set to application/json.
Authorization: Required. Set to a valid Bearer access token.

For more information about how to create the request, see Components of a REST API request/response.

Create the request body

The following common definitions are used to build a request body:

Name Required Type Description
eTag String Optional eTag
location true String Resource location
properties VaultProperties Properties of the vault
sku Sku Identifies the unique system identifier for each Azure resource
tags Object Resource tags

Note that vault name and resource group name are provided in the PUT URI. The request body defines the location.

Example request body

The following example body is used to create a vault in "West US". Specify the location. The SKU is always "Standard".

{
  "properties": {},
  "sku": {
    "name": "Standard"
  },
  "location": "West US"
}

Responses

There are two successful responses for the operation to create or update a Recovery Services vault:

Name Type Description
200 OK Vault OK
201 Created Vault Created

For more information about REST API responses, see Process the response message.

Example response

A condensed 201 Created response from the previous example request body shows an id has been assigned and the provisioningState is Succeeded:

{
  "location": "westus",
  "name": "testVault",
  "properties": {
    "provisioningState": "Succeeded"
  },
  "id": "/subscriptions/77777777-b0c6-47a2-b37c-d8e65a629c18/resourceGroups/Default-RecoveryServices-ResourceGroup/providers/Microsoft.RecoveryServices/vaults/testVault",
  "type": "Microsoft.RecoveryServices/vaults",
  "sku": {
    "name": "Standard"
  }
}

Next steps

Create a backup policy for backing up an Azure VM in this vault.

For more information on the Azure REST APIs, see the following documents: