本文說明如何使用適用於 Azure 備份的數據保護 REST API,在適用於 PostgreSQL 的 Azure 資料庫中設定 PostgreSQL 資料庫的備份。 您也可以使用適用於 PostgreSQL 資料庫的 Azure 入口網站、 Azure PowerShell 和 Azure CLI 來設定備份。
如需適用於 PostgreSQL 的 Azure 資料庫中 PostgreSQL 資料庫備份支援案例、限制和驗證機制的資訊,請參閱 概觀 文章。
必要條件
設定備份
建立保存庫和原則之後,您必須考慮三個關鍵點,以在適用於PostgreSQL的 Azure 資料庫中備份 PostgreSQL 資料庫。
瞭解重要實體
要備份的 PostgreSQL 資料庫
擷取要備份之 PostgreSQL 資料庫的 Azure Resource Manager 識別符。 此標識碼可作為資料庫的標識碼。 下列範例會使用 PostgreSQL 伺服器底下名為 empdb11 的資料庫,此資料庫 testposgresql存在於不同訂用帳戶下的資源群組 ossrg 中。 此範例使用Bash。
"/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx/resourcegroups/ossdemoRG/providers/Microsoft.DBforPostgreSQL/servers/testpostgresql/databases/empdb11"
金鑰保存庫
Azure 備份服務不會儲存連線到 PostgreSQL 資料庫所用的使用者名稱和密碼。 相反地,備份管理員會將 密鑰 植入金鑰保存庫。 Azure 備份服務接著會存取金鑰保存庫、讀取密鑰,以及存取資料庫。
下列範例使用Bash。 請記下相關金鑰的祕密識別碼。
"https://testkeyvaulteus.vault.azure.net/secrets/ossdbkey"
備份保存庫
備份保存庫必須連線到 PostgreSQL 伺服器,然後透過密鑰保存庫中存在的金鑰存取資料庫。 因此,備份保存庫需要存取 PostgreSQL 伺服器和密鑰保存庫。 存取權會授與備份保存庫的受控識別。
您必須將權限授予 PostgreSQL 伺服器上的備份保存庫受控識別,以及儲存資料庫金鑰的金鑰保存庫權限。 深入了解。
準備要求
在您對保存庫和 PostgreSQL 資料庫設定相關權限,並且配置保存庫及原則之後,請準備好配置備份的請求。 使用下列要求本文來設定 PostgreSQL 資料庫的備份。 PostgreSQL 資料庫的 Resource Manager 識別符及其詳細數據位於 區 dataSourceInfo 段中。 原則信息位於 policyInfo 區段中。
{
"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"
}
}
驗證設定備份的要求
若要驗證設定備份的要求是否成功,請使用 驗證備份 API。 您可以使用回應來執行所需的必要條件,然後提交備份要求的設定。
驗證備份要求是 POST 作業。 URI 包含 {subscriptionId}、 {vaultName}與 {vaultresourceGroupName} 參數:
POST https://management.azure.com/Subscriptions/{subscriptionId}/resourceGroups/{vaultresourceGroupname}/providers/Microsoft.DataProtection/backupVaults/{backupVaultName}/validateForBackup?api-version=2021-01-01
例如,上述 API 會轉譯為:
POST https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/TestBkpVaultRG/providers/Microsoft.DataProtection/backupVaults/testBkpVault/validateForBackup?api-version=2021-01-01
您稍早準備的 請求主體 提供要備份之 PostgreSQL 資料庫的詳細資料。
範例請求正文
{
"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"
}
}
備份要求驗證的回應
備份要求驗證是非同步作業。 因此,此作業會建立另一項需要個別追蹤的作業。
此作業會傳回這些回應:
| 名稱 | 類型 | 描述 |
|---|---|---|
202 Accepted |
系統會建立另一個作業。 將以非同步方式完成作業。 | |
200 OK |
OperationJobExtendedInfo |
作業已完成。 |
| 其他狀態代碼 | CloudError |
錯誤回應描述作業失敗的原因。 |
範例錯誤回應
如果磁碟已設定為備份,則會以 HTTP 400 Bad request傳回回應。 回應會指出磁碟已備份至保存庫,並提供詳細資料:
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
}
}
追蹤回應範例
如果數據源未受保護,API 會繼續進行進一步驗證,並建立追蹤作業:
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
使用 Azure-AsyncOperation 標頭搭配簡單的 GET 命令來追蹤產生的作業:
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"
}
作業會在作業完成時傳回 200 OK 。 回應主體會列出進一步需要滿足的要求,例如權限:
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"
}
如果您授與所有許可權,請重新提交驗證要求並追蹤產生的作業。 如果符合所有條件,則會傳回成功回應 200 OK 。
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"
}
設定備份要求
驗證要求之後,您可以將要求提交至 建立備份實例 API。 其中一個 Azure 備份數據保護服務可協助保護備份保存庫中的備份實例。 在這裡,PostgreSQL 資料庫是備份實例。 使用先前已驗證的請求體,並進行輕微的新增。
使用備份執行個體的唯一名稱。 我們建議您使用資源名稱和唯一標識碼的組合。 例如,下列作業會使用 testpostgresql-empdb11-957d23b1-c679-4c94-ade6-c4d34635e149 並將它標示為備份實例的名稱。
若要建立或更新備份實例,請使用下列 PUT 作業:
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/{BkpvaultName}/backupInstances/{UniqueBackupInstanceName}?api-version=2021-01-01
例如,上述 API 會轉譯為:
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
設定備份的要求
若要建立備份實例,請在要求本文中使用下列元件:
| 名稱 | 類型 | 描述 |
|---|---|---|
properties |
BackupInstance |
BackupInstanceResource 屬性 |
下列範例要求會使用您用來驗證備份要求的相同要求本文 (部分內容可能是機器或 AI 翻譯),但需指定一個唯一名稱:
{
"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"
}
}
設定備份要求的回應
建立備份執行個體要求是非同步作業 (部分內容可能是機器或 AI 翻譯)。 因此,此作業會建立另一項需要個別追蹤的作業。
此作業會傳回這些回應:
| 名稱 | 類型 | 描述 |
|---|---|---|
201 Created |
備份執行個體 | 會建立備份實例,並設定保護。 |
200 OK |
備份執行個體 | 已設定保護。 |
| 其他狀態代碼 | CloudError | 錯誤回應描述作業失敗的原因。 |
提交 PUT 要求以建立備份執行個體之後,初始回覆將包含 Azure-asyncOperation 標頭的 201 Created。 在以下範例中,請注意,請求主體包含所有備份實例的屬性。
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"
}
使用 Azure-AsyncOperation 標頭搭配簡單的 GET 命令來追蹤產生的作業:
GET https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/providers/Microsoft.DataProtection/locations/westus/operationStatus/ZmMzNDFmYWMtZWJlMS00NGJhLWE4YTgtMDNjYjI4Y2M5OTExOzI1NWUwNmFlLTI5MjUtNDBkNy1iMjMxLTM0ZWZlMDA3NjdkYQ==?api-version=2021-01-01
當作業完成時,它會回傳 200 OK,並在回應本文包含 Succeeded 訊息:
{
"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"
}
停止保護並刪除資料
若要移除 PostgreSQL 資料庫的保護並刪除備份數據,請執行 DELETE 作業:
DELETE https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}?api-version=2021-01-01
例如,上述 API 會轉譯為:
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"
停止保護和刪除數據的應對措施
DELETE 是 異步操作。 因此,此作業會建立另一項需要個別追蹤的作業。
此作業會傳回這些回應:
| 名稱 | 類型 | 描述 |
|---|---|---|
200 OK |
作業已完成。 | |
202 Accepted |
已接受作業。 系統會建立另一個作業。 |
提交 DELETE 要求之後,初始回應會 202 Accepted 包含 Azure-asyncOperation 標頭,如下列範例回應所示:
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
使用簡單的Azure-AsyncOperation請求來追蹤GET標頭。 當要求成功時,它會傳 200 OK 回狀態回應。
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"
}