Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This article describes how to manage backups for PostgreSQL databases in Azure Database for PostgreSQL by using the Data Protection REST API for Azure Backup.
For information on the supported scenarios, limitations, and authentication mechanisms for PostgreSQL database backup in Azure Database for PostgreSQL, see the overview article.
Prerequisites
Configure backup
After you create the vault and policy, you need to consider three critical points to back up a PostgreSQL database in Azure Database for PostgreSQL.
Understand key entities
PostgreSQL database to be backed up
Fetch the Azure Resource Manager ID of the PostgreSQL database to be backed up. This ID serves as the identifier of the database. The following example uses a database named empdb11
under the PostgreSQL server testposgresql
, which is present in the resource group ossrg
under a different subscription. The example uses Bash.
"/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx/resourcegroups/ossdemoRG/providers/Microsoft.DBforPostgreSQL/servers/testpostgresql/databases/empdb11"
Key vault
The Azure Backup service doesn't store the username and password to connect to the PostgreSQL database. Instead, the backup admin seeds the keys into the key vault. The Azure Backup service then accesses the key vault, reads the keys, and accesses the database.
The following example uses Bash. Note the secret identifier of the relevant key.
"https://testkeyvaulteus.vault.azure.net/secrets/ossdbkey"
Backup vault
A Backup vault has to connect to the PostgreSQL server and then access the database via the keys present in the key vault. So, the Backup vault requires access to the PostgreSQL server and the key vault. Access is granted to the Backup vault's managed identity.
You need to grant permissions to the Backup vault's managed identity on the PostgreSQL server and the key vault that stores the keys to the database. Learn more.
Prepare the request
After you set the relevant permissions to the vault and the PostgreSQL database, and you configure the vault and the policy, prepare the request to configure backup. Use the following request body to configure backup for a PostgreSQL database. The Resource Manager ID of the PostgreSQL database and its details are in the dataSourceInfo
section. The policy information is in the policyInfo
section.
{
"backupInstance": {
"dataSourceInfo": {
"resourceID": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/ossdemoRG/providers/Microsoft.DBforPostgreSQL/servers/testpostgresql/databases/empdb11",
"resourceUri": "",
"datasourceType": "Microsoft.DBforPostgreSQL/servers/databases",
"resourceName": "empdb11",
"resourceType": "Microsoft.DBforPostgreSQL/servers/databases",
"resourceLocation": "westUS",
"objectType": "Datasource"
},
"dataSourceSetInfo": {
"resourceID": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/ossdemoRG/providers/Microsoft.DBforPostgreSQL/servers/testpostgresql",
"resourceUri": "",
"datasourceType": "Microsoft.DBforPostgreSQL/servers/databases",
"resourceName": "testpostgresql",
"resourceType": "Microsoft.DBforPostgreSQL/servers",
"resourceLocation": "westUS",
"objectType": "DatasourceSet"
},
"policyInfo": {
"policyId": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/testBkpVaultRG/providers/Microsoft.DataProtection/backupVaults/testBkpVault/backupPolicies/osspol3",
"policyVersion": ""
},
"objectType": "BackupInstance"
}
}
Validate the request to configure backup
To validate if the request to configure backup will be successful, use the Validate For Backup API. You can use the response to perform the required prerequisites, and then submit the configuration for the backup request.
Validation of a backup request is a POST
operation. The URI contains {subscriptionId}
, {vaultName}
, and {vaultresourceGroupName}
parameters:
POST https://management.azure.com/Subscriptions/{subscriptionId}/resourceGroups/{vaultresourceGroupname}/providers/Microsoft.DataProtection/backupVaults/{backupVaultName}/validateForBackup?api-version=2021-01-01
For example, the preceding API translates to:
POST https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/TestBkpVaultRG/providers/Microsoft.DataProtection/backupVaults/testBkpVault/validateForBackup?api-version=2021-01-01
The request body that you prepared earlier provides details about the PostgreSQL database to be backed up.
Example request body
{
"backupInstance": {
"dataSourceInfo": {
"resourceID": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/ossdemoRG/providers/Microsoft.DBforPostgreSQL/servers/testpostgresql/databases/empdb11",
"resourceUri": "",
"datasourceType": "Microsoft.DBforPostgreSQL/servers/databases",
"resourceName": "empdb11",
"resourceType": "Microsoft.DBforPostgreSQL/servers/databases",
"resourceLocation": "westUS",
"objectType": "Datasource"
},
"dataSourceSetInfo": {
"resourceID": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/ossdemoRG/providers/Microsoft.DBforPostgreSQL/servers/testpostgresql",
"resourceUri": "",
"datasourceType": "Microsoft.DBforPostgreSQL/servers/databases",
"resourceName": "testpostgresql",
"resourceType": "Microsoft.DBforPostgreSQL/servers",
"resourceLocation": "westUS",
"objectType": "DatasourceSet"
},
"policyInfo": {
"policyId": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/testBkpVaultRG/providers/Microsoft.DataProtection/backupVaults/testBkpVault/backupPolicies/osspol3",
"policyVersion": ""
},
"objectType": "BackupInstance"
}
}
Responses for backup request validation
Backup request validation is an asynchronous operation. So, this operation creates another operation that needs to be tracked separately.
The operation returns these responses:
Name | Type | Description |
---|---|---|
202 Accepted |
Another operation is created. The operation will be completed asynchronously. | |
200 OK |
OperationJobExtendedInfo |
The operation is completed. |
Other status codes | CloudError |
The error response describes why the operation failed. |
Example error response
If the disk is already configured for backup, it returns the response as HTTP 400 Bad request
. The response states that the disk is backed up to a vault, along with details:
HTTP/1.1 400 BadRequest
Content-Length: 1012
Content-Type: application/json
Expires: -1
Pragma: no-cache
X-Content-Type-Options: nosniff
x-ms-request-id:
Strict-Transport-Security: max-age=31536000; includeSubDomains
x-ms-ratelimit-remaining-subscription-writes: 1199
x-ms-correlation-request-id: 0c99ff0f-6c26-4ec7-899f-205435e89894
x-ms-routing-request-id: WESTUS:20210830T142949Z:0be72802-02ad-485d-b91f-4aadd92c059c
Cache-Control: no-cache
Date: Mon, 30 Aug 2021 14:29:49 GMT
X-Powered-By: ASP.NET
{
"error": {
"additionalInfo": [
{
"type": "UserFacingError",
"info": {
"message": "Datasource is already protected under the Backup vault /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/TestBkpVaultRG/providers/Microsoft.DataProtection/backupVaults/testBkpVault.",
"recommendedAction": [
"Delete the backup instance testpostgresql-empdb11-957d23b1-c679-4c94-ade6-c4d34635e149 from the Backup vault /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/TestBkpVaultRG/providers/Microsoft.DataProtection/backupVaults/testBkpVault to re-protect the datasource in any other vault."
],
"details": null,
"code": "UserErrorDppDatasourceAlreadyProtected",
"target": "",
"innerError": null,
"isRetryable": false,
"isUserError": false,
"properties": {
"ActivityId": "0c99ff0f-6c26-4ec7-899f-205435e89894"
}
}
}
],
"code": "UserErrorDppDatasourceAlreadyProtected",
"message": "Datasource is already protected under the Backup vault /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/TestBkpVaultRG/providers/Microsoft.DataProtection/backupVaults/testBkpVault.",
"target": null,
"details": null
}
}
Example tracking response
If the data source is unprotected, the API proceeds for further validations and creates a tracking operation:
HTTP/1.1 202 Accepted
Content-Length: 0
Expires: -1
Pragma: no-cache
Retry-After: 10
Azure-AsyncOperation: https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/providers/Microsoft.DataProtection/locations/westus/operationStatus/ZmMzNDFmYWMtZWJlMS00NGJhLWE4YTgtMDNjYjI4Y2M5OTExOzM2NDdhZDNjLTFiNGEtNDU4YS05MGJkLTQ4NThiYjRhMWFkYg==?api-version=2021-01-01
X-Content-Type-Options: nosniff
x-ms-request-id:
Strict-Transport-Security: max-age=31536000; includeSubDomains
x-ms-ratelimit-remaining-subscription-writes: 1197
x-ms-correlation-request-id: 3e7cacb3-65cd-4b3c-8145-71fe90d57327
x-ms-routing-request-id: WESTUS:20210707T124850Z:105f2105-6db1-44bf-8a34-45972a8ba861
Cache-Control: no-cache
Date: Wed, 07 Jul 2021 12:48:50 GMT
Location: https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/providers/Microsoft.DataProtection/locations/westus/operationResults/ZmMzNDFmYWMtZWJlMS00NGJhLWE4YTgtMDNjYjI4Y2M5OTExOzM2NDdhZDNjLTFiNGEtNDU4YS05MGJkLTQ4NThiYjRhMWFkYg==?api-version=2021-01-01
X-Powered-By: ASP.NET
Track the resulting operation by using the Azure-AsyncOperation
header with a simple GET
command:
GET https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/providers/Microsoft.DataProtection/locations/westus/operationStatus/ZmMzNDFmYWMtZWJlMS00NGJhLWE4YTgtMDNjYjI4Y2M5OTExOzM2NDdhZDNjLTFiNGEtNDU4YS05MGJkLTQ4NThiYjRhMWFkYg==?api-version=2021-01-01
{
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/providers/Microsoft.DataProtection/locations/westus/operationStatus/ZmMzNDFmYWMtZWJlMS00NGJhLWE4YTgtMDNjYjI4Y2M5OTExOzM2NDdhZDNjLTFiNGEtNDU4YS05MGJkLTQ4NThiYjRhMWFkYg==",
"name": "ZmMzNDFmYWMtZWJlMS00NGJhLWE4YTgtMDNjYjI4Y2M5OTExOzM2NDdhZDNjLTFiNGEtNDU4YS05MGJkLTQ4NThiYjRhMWFkYg==",
"status": "Inprogress",
"startTime": "2021-07-07T12:48:50.3432229Z",
"endTime": "0001-01-01T00:00:00"
}
The operation returns 200 OK
when it finishes. The response body then lists further requirements to be fulfilled, such as permissions:
GET https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/providers/Microsoft.DataProtection/locations/westus/operationStatus/ZmMzNDFmYWMtZWJlMS00NGJhLWE4YTgtMDNjYjI4Y2M5OTExOzM2NDdhZDNjLTFiNGEtNDU4YS05MGJkLTQ4NThiYjRhMWFkYg==?api-version=2021-01-01
{
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/providers/Microsoft.DataProtection/locations/westus/operationStatus/ZmMzNDFmYWMtZWJlMS00NGJhLWE4YTgtMDNjYjI4Y2M5OTExOzM2NDdhZDNjLTFiNGEtNDU4YS05MGJkLTQ4NThiYjRhMWFkYg==",
"name": "ZmMzNDFmYWMtZWJlMS00NGJhLWE4YTgtMDNjYjI4Y2M5OTExOzM2NDdhZDNjLTFiNGEtNDU4YS05MGJkLTQ4NThiYjRhMWFkYg==",
"status": "Failed",
"error": {
"additionalInfo": [
{
"type": "UserFacingError",
"info": {
"message": "Appropriate permissions to perform the operation is missing.",
"recommendedAction": [
"Grant appropriate permissions to perform this operation as mentioned at https://aka.ms/UserErrorMissingRequiredPermissions and retry the operation."
],
"code": "UserErrorMissingRequiredPermissions",
"target": "",
"innerError": {
"code": "UserErrorMissingRequiredPermissions",
"additionalInfo": {
"DetailedNonLocalisedMessage": "Validate for Protection failed. Exception Message: The client '00001111-aaaa-2222-bbbb-3333cccc4444' with object id 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' does not have authorization to perform action 'Microsoft.Authorization/roleAssignments/read' over scope '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/ossdemoRG/providers/Microsoft.DBforPostgreSQL/servers/testpostgresql/providers/Microsoft.Authorization' or the scope is invalid. If access was recently granted, please refresh your credentials."
}
},
"isRetryable": false,
"isUserError": false,
"properties": {
"ActivityId": "3e7cacb3-65cd-4b3c-8145-71fe90d57327"
}
}
}
],
"code": "UserErrorMissingRequiredPermissions",
"message": "Appropriate permissions to perform the operation is missing."
},
"startTime": "2021-07-07T12:48:50.3432229Z",
"endTime": "2021-07-07T12:49:22Z"
}
If you grant all permissions, then resubmit the validation request and track the resulting operation. It returns the success response 200 OK
if all the conditions are met.
GET https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/providers/Microsoft.DataProtection/locations/westus/operationStatus/ZmMzNDFmYWMtZWJlMS00NGJhLWE4YTgtMDNjYjI4Y2M5OTExOzlhMjk2YWM2LWRjNDMtNGRjZS1iZTU2LTRkZDNiMDhjZDlkOA==?api-version=2021-01-01
{
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/providers/Microsoft.DataProtection/locations/westus/operationStatus/ZmMzNDFmYWMtZWJlMS00NGJhLWE4YTgtMDNjYjI4Y2M5OTExOzlhMjk2YWM2LWRjNDMtNGRjZS1iZTU2LTRkZDNiMDhjZDlkOA==",
"name": "ZmMzNDFmYWMtZWJlMS00NGJhLWE4YTgtMDNjYjI4Y2M5OTExOzlhMjk2YWM2LWRjNDMtNGRjZS1iZTU2LTRkZDNiMDhjZDlkOA==",
"status": "Succeeded",
"startTime": "2021-07-07T13:03:54.8627251Z",
"endTime": "2021-07-07T13:04:06Z"
}
Configure a backup request
After the request is validated, you can submit the request to the Create Backup Instance API. One of the Azure Backup data protection services helps protect the backup instance within the Backup vault. Here, the PostgreSQL database is the backup instance. Use the previously validated request body with minor additions.
Use a unique name for the backup instance. We recommend that you use a combination of the resource name and a unique identifier. For example, the following operation uses testpostgresql-empdb11-957d23b1-c679-4c94-ade6-c4d34635e149
and marks it as the name of the backup instance.
To create or update the backup instance, use the following PUT
operation:
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/{BkpvaultName}/backupInstances/{UniqueBackupInstanceName}?api-version=2021-01-01
For example, the preceding API translates to:
PUT https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/TestBkpVaultRG/providers/Microsoft.DataProtection/backupVaults/testBkpVault/backupInstances/testpostgresql-empdb11-957d23b1-c679-4c94-ade6-c4d34635e149?api-version=2021-01-01
Request for configuring a backup
To create a backup instance, use the following components in the request body:
Name | Type | Description |
---|---|---|
properties |
BackupInstance |
BackupInstanceResource properties |
The following example request uses the same request body that you used to validate the backup request, with a unique name:
{
"name": "testpostgresql-empdb11-957d23b1-c679-4c94-ade6-c4d34635e149",
"type": "Microsoft.DataProtection/backupvaults/backupInstances",
"properties": {
"dataSourceInfo": {
"resourceID": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/ossdemoRG/providers/Microsoft.DBforPostgreSQL/servers/testpostgresql/databases/empdb11",
"resourceUri": "",
"datasourceType": "Microsoft.DBforPostgreSQL/servers/databases",
"resourceName": "empdb11",
"resourceType": "Microsoft.DBforPostgreSQL/servers/databases",
"resourceLocation": "westUS",
"objectType": "Datasource"
},
"dataSourceSetInfo": {
"resourceID": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/ossdemoRG/providers/Microsoft.DBforPostgreSQL/servers/testpostgresql",
"resourceUri": "",
"datasourceType": "Microsoft.DBforPostgreSQL/servers/databases",
"resourceName": "testpostgresql",
"resourceType": "Microsoft.DBforPostgreSQL/servers",
"resourceLocation": "westUS",
"objectType": "DatasourceSet"
},
"policyInfo": {
"policyId": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/testBkpVaultRG/providers/Microsoft.DataProtection/backupVaults/testBkpVault/backupPolicies/osspol3",
"policyVersion": ""
}
},
"objectType": "BackupInstance"
}
}
Responses to configuring a backup request
Creating a backup instance request is an asynchronous operation. So, this operation creates another operation that needs to be tracked separately.
The operation returns these responses:
Name | Type | Description |
---|---|---|
201 Created |
Backup instance | The backup instance is created, and protection is configured. |
200 OK |
Backup instance | Protection is configured. |
Other status codes | CloudError | The error responses describe why the operation failed. |
After you submit the PUT
request to create a backup instance, the initial response is 201 Created
with an Azure-asyncOperation
header. In the following example, note that the request body contains all the backup instance properties:
HTTP/1.1 201 Created
Content-Length: 1149
Content-Type: application/json
Expires: -1
Pragma: no-cache
Retry-After: 15
Azure-AsyncOperation: https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/providers/Microsoft.DataProtection/locations/westus/operationStatus/ZmMzNDFmYWMtZWJlMS00NGJhLWE4YTgtMDNjYjI4Y2M5OTExOzI1NWUwNmFlLTI5MjUtNDBkNy1iMjMxLTM0ZWZlMDA3NjdkYQ==?api-version=2021-01-01
X-Content-Type-Options: nosniff
x-ms-request-id:
Strict-Transport-Security: max-age=31536000; includeSubDomains
x-ms-ratelimit-remaining-subscription-writes: 1199
x-ms-correlation-request-id: 5d9ccf1b-7ac1-456d-8ae3-36c93c0d2427
x-ms-routing-request-id: WESTUS:20210707T170219Z:9e897266-5d86-4d13-b298-6561c60cf043
Cache-Control: no-cache
Date: Wed, 07 Jul 2021 17:02:18 GMT
Server: Microsoft-IIS/10.0
X-Powered-By: ASP.NET
{
"properties": {
"friendlyName": "testpostgresql-empdb11-957d23b1-c679-4c94-ade6-c4d34635e149",
"dataSourceInfo": {
"resourceID": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/ossdemoRG/providers/Microsoft.DBforPostgreSQL/servers/testpostgresql/databases/empdb11",
"resourceUri": "",
"datasourceType": "Microsoft.DBforPostgreSQL/servers/databases",
"resourceName": "empdb11",
"resourceType": "Microsoft.DBforPostgreSQL/servers/databases",
"resourceLocation": "westUS",
"objectType": "Datasource"
},
"dataSourceSetInfo": {
"resourceID": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/ossdemoRG/providers/Microsoft.DBforPostgreSQL/servers/testpostgresql",
"resourceUri": "",
"datasourceType": "Microsoft.DBforPostgreSQL/servers/databases",
"resourceName": "testpostgresql",
"resourceType": "Microsoft.DBforPostgreSQL/servers",
"resourceLocation": "westUS",
"objectType": "DatasourceSet"
},
"policyInfo": {
"policyId": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/testBkpVaultRG/providers/Microsoft.DataProtection/backupVaults/testBkpVault/backupPolicies/osspol3",
"policyVersion": ""
},
"protectionStatus": {
"status": "ProtectionConfigured"
},
"currentProtectionState": "ProtectionConfigured",
"provisioningState": "Succeeded",
"objectType": "BackupInstance"
},
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/testBkpVaultRG/providers/Microsoft.DataProtection/backupVaults/testBkpVault/backupInstances/testpostgresql-empdb11-957d23b1-c679-4c94-ade6-c4d34635e149",
"name": "testpostgresql-empdb11-957d23b1-c679-4c94-ade6-c4d34635e149",
"type": "Microsoft.DataProtection/backupVaults/backupInstances"
}
Track the resulting operation by using the Azure-AsyncOperation
header with a simple GET
command:
GET https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/providers/Microsoft.DataProtection/locations/westus/operationStatus/ZmMzNDFmYWMtZWJlMS00NGJhLWE4YTgtMDNjYjI4Y2M5OTExOzI1NWUwNmFlLTI5MjUtNDBkNy1iMjMxLTM0ZWZlMDA3NjdkYQ==?api-version=2021-01-01
When the operation finishes, it returns 200 OK
with the Succeeded
message in the response body:
{
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/providers/Microsoft.DataProtection/locations/westus/operationStatus/ZmMzNDFmYWMtZWJlMS00NGJhLWE4YTgtMDNjYjI4Y2M5OTExOzI1NWUwNmFlLTI5MjUtNDBkNy1iMjMxLTM0ZWZlMDA3NjdkYQ==",
"name": "ZmMzNDFmYWMtZWJlMS00NGJhLWE4YTgtMDNjYjI4Y2M5OTExOzI1NWUwNmFlLTI5MjUtNDBkNy1iMjMxLTM0ZWZlMDA3NjdkYQ==",
"status": "Succeeded",
"startTime": "2021-07-07T17:02:19.0611871Z",
"endTime": "2021-07-07T17:02:20Z"
}
Stop protection and delete data
To remove the protection on a PostgreSQL database and delete the backup data, perform a DELETE operation:
DELETE https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}?api-version=2021-01-01
For example, the preceding API translates to:
DELETE "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/TestBkpVaultRG/providers/Microsoft.DataProtection/backupVaults/testBkpVault/backupInstances/testpostgresql-empdb11-957d23b1-c679-4c94-ade6-c4d34635e149?api-version=2021-01-01"
Responses for stopping protection and deleting data
DELETE
is an asynchronous operation. So, this operation creates another operation that needs to be tracked separately.
The operation returns these responses:
Name | Type | Description |
---|---|---|
200 OK |
The operation finished. | |
202 Accepted |
The operation is accepted. Another operation is created. |
After you submit the DELETE
request, the initial response is 202 Accepted
with an Azure-asyncOperation
header, as shown in this example response:
HTTP/1.1 202 Accepted
Content-Length: 0
Expires: -1
Pragma: no-cache
Retry-After: 30
Azure-AsyncOperation: https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/providers/Microsoft.DataProtection/locations/westus/operationStatus/ZmMzNDFmYWMtZWJlMS00NGJhLWE4YTgtMDNjYjI4Y2M5OTExOzE1ZjM4YjQ5LWZhMGQtNDMxOC1iYjQ5LTExMDJjNjUzNjM5Zg==?api-version=2021-01-01
X-Content-Type-Options: nosniff
x-ms-request-id:
Strict-Transport-Security: max-age=31536000; includeSubDomains
x-ms-ratelimit-remaining-subscription-deletes: 14999
x-ms-correlation-request-id: fee7a361-b1b3-496d-b398-60fed030d5a7
x-ms-routing-request-id: WESTUS:20210708T071330Z:5c3a9f3e-53aa-4d5d-bf9a-20de5601b090
Cache-Control: no-cache
Date: Thu, 08 Jul 2021 07:13:29 GMT
Location: https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/providers/Microsoft.DataProtection/locations/westus/operationResults/ZmMzNDFmYWMtZWJlMS00NGJhLWE4YTgtMDNjYjI4Y2M5OTExOzE1ZjM4YjQ5LWZhMGQtNDMxOC1iYjQ5LTExMDJjNjUzNjM5Zg==?api-version=2021-01-01
X-Powered-By: ASP.NET
Track the Azure-AsyncOperation
header with a simple GET
request. When the request is successful, it returns a 200 OK
status response.
GET "https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/providers/Microsoft.DataProtection/locations/westus/operationStatus/ZmMzNDFmYWMtZWJlMS00NGJhLWE4YTgtMDNjYjI4Y2M5OTExOzE1ZjM4YjQ5LWZhMGQtNDMxOC1iYjQ5LTExMDJjNjUzNjM5Zg==?api-version=2021-01-01"
{
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/providers/Microsoft.DataProtection/locations/westus/operationStatus/ZmMzNDFmYWMtZWJlMS00NGJhLWE4YTgtMDNjYjI4Y2M5OTExOzE1ZjM4YjQ5LWZhMGQtNDMxOC1iYjQ5LTExMDJjNjUzNjM5Zg==",
"name": "ZmMzNDFmYWMtZWJlMS00NGJhLWE4YTgtMDNjYjI4Y2M5OTExOzE1ZjM4YjQ5LWZhMGQtNDMxOC1iYjQ5LTExMDJjNjUzNjM5Zg==",
"status": "Succeeded",
"startTime": "2021-07-08T07:13:30.23815Z",
"endTime": "2021-07-08T07:13:46Z"
}