Catatan
Akses ke halaman ini memerlukan otorisasi. Anda dapat mencoba masuk atau mengubah direktori.
Akses ke halaman ini memerlukan otorisasi. Anda dapat mencoba mengubah direktori.
Artikel ini menjelaskan cara mengonfigurasi cadangan untuk database PostgreSQL di Azure Database for PostgreSQL dengan menggunakan REST API Perlindungan Data untuk Azure Backup. Anda juga dapat mengonfigurasi pencadangan menggunakan portal Microsoft Azure, Azure PowerShell, dan azure CLI untuk database PostgreSQL.
Untuk informasi tentang skenario, batasan, dan mekanisme autentikasi yang didukung untuk pencadangan database PostgreSQL di Azure Database for PostgreSQL, lihat artikel gambaran umum .
Prasyarat
Konfigurasi cadangan
Setelah membuat vault dan kebijakan, Anda perlu mempertimbangkan tiga langkah penting untuk mencadangkan database PostgreSQL di Azure Database for PostgreSQL.
Memahami entitas utama
Basis data PostgreSQL yang akan dicadangkan
Ambil ID Azure Resource Manager dari database PostgreSQL untuk dicadangkan. ID ini berfungsi sebagai pengidentifikasi database. Contoh berikut menggunakan database bernama empdb11 di bawah server testposgresqlPostgreSQL , yang ada di grup ossrg sumber daya di bawah langganan yang berbeda. Contohnya menggunakan Bash.
"/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx/resourcegroups/ossdemoRG/providers/Microsoft.DBforPostgreSQL/servers/testpostgresql/databases/empdb11"
Penyimpanan kunci
Layanan Azure Backup tidak menyimpan nama pengguna dan kata sandi untuk tersambung ke database PostgreSQL. Sebagai gantinya, admin cadangan memasukkan kunci ke dalam brankas kunci. Layanan Azure Backup kemudian mengakses brankas kunci, membaca kunci, dan mengakses database.
Contoh berikut menggunakan Bash. Catat pengidentifikasi rahasia dari kunci yang relevan.
"https://testkeyvaulteus.vault.azure.net/secrets/ossdbkey"
Kubah cadangan
Vault Backup harus terhubung ke server PostgreSQL lalu mengakses database melalui kunci yang ada di brankas kunci. Jadi, vault Backup memerlukan akses ke server PostgreSQL dan brankas kunci. Akses diberikan ke identitas terkelola brankas Backup.
Anda perlu memberikan izin ke identitas terkelola brankas Backup di server PostgreSQL dan brankas kunci yang menyimpan kunci ke database. Pelajari selengkapnya.
Siapkan permintaan
Setelah Anda mengatur perizinan yang relevan untuk vault dan database PostgreSQL, serta mengonfigurasi vault dan kebijakannya, siapkan permintaan untuk mengonfigurasi cadangan. Gunakan isi permintaan berikut untuk mengonfigurasi cadangan untuk database PostgreSQL. ID Resource Manager dari database PostgreSQL dan detailnya ada di bagian .dataSourceInfo Informasi kebijakan ada di bagian 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"
}
}
Validasi permintaan untuk mengonfigurasi cadangan
Untuk memvalidasi apakah permintaan untuk mengonfigurasi pencadangan akan berhasil, gunakan API Validasi Untuk Pencadangan. Anda dapat menggunakan respons untuk memenuhi prasyarat yang diperlukan, lalu mengajukan konfigurasi untuk permintaan pencadangan.
Validasi permintaan cadangan adalah suatu operasi POST. URI berisi {subscriptionId}parameter , {vaultName}, dan {vaultresourceGroupName} :
POST https://management.azure.com/Subscriptions/{subscriptionId}/resourceGroups/{vaultresourceGroupname}/providers/Microsoft.DataProtection/backupVaults/{backupVaultName}/validateForBackup?api-version=2021-01-01
Misalnya, API sebelumnya diterjemahkan ke:
POST https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/TestBkpVaultRG/providers/Microsoft.DataProtection/backupVaults/testBkpVault/validateForBackup?api-version=2021-01-01
Isi permintaan yang Anda siapkan sebelumnya memberikan rincian tentang database PostgreSQL yang akan dicadangkan.
Contoh isi permintaan
{
"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"
}
}
Respons untuk memvalidasi permintaan cadangan
Validasi permintaan cadangan adalah operasi asinkron. Jadi, operasi ini akan menciptakan operasi lain yang perlu dilacak secara terpisah.
Operasi mengembalikan respons ini:
| Nama | Tipe | Deskripsi |
|---|---|---|
202 Accepted |
Operasi lain dibuat. Operasi akan diselesaikan secara asinkron. | |
200 OK |
OperationJobExtendedInfo |
Operasi selesai. |
| Kode status lainnya | CloudError |
Respons kesalahan menjelaskan mengapa operasi gagal. |
Contoh respons kesalahan
Jika disk sudah dikonfigurasi untuk cadangan, disk mengembalikan respons sebagai HTTP 400 Bad request. Pernyataan menyebutkan bahwa disk dicadangkan ke dalam brankas, beserta detail-detailnya:
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
}
}
Contoh respons pelacakan
Jika sumber data tidak terlindungi, API melanjutkan validasi lebih lanjut dan membuat operasi pelacakan:
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
Lacak operasi yang dihasilkan dengan menggunakan Azure-AsyncOperation header dengan perintah sederhana 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"
}
Operasi mengembalikan 200 OK saat selesai. Isi respons kemudian mencantumkan persyaratan lebih lanjut yang harus dipenuhi, seperti izin:
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"
}
Jika Anda memberikan semua izin, kirim ulang permintaan validasi dan lacak operasi yang dihasilkan. Ini mengembalikan respons 200 OK keberhasilan jika semua kondisi terpenuhi.
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"
}
Mengonfigurasi permintaan pencadangan
Setelah permintaan divalidasi, Anda dapat mengirimkan permintaan ke API Buat Instans Cadangan. Salah satu layanan perlindungan data Azure Backup membantu melindungi instans cadangan dalam vault Backup. Di sini, database PostgreSQL adalah instans cadangan. Gunakan isi permintaan yang divalidasi sebelumnya dengan penambahan kecil.
Gunakan nama unik untuk instans cadangan. Kami menyarankan agar Anda menggunakan kombinasi nama sumber daya dan pengidentifikasi unik. Misalnya, operasi berikut menggunakan testpostgresql-empdb11-957d23b1-c679-4c94-ade6-c4d34635e149 dan menandainya sebagai nama instans cadangan.
Untuk membuat atau memperbarui instans cadangan, gunakan operasi berikut PUT :
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/{BkpvaultName}/backupInstances/{UniqueBackupInstanceName}?api-version=2021-01-01
Misalnya, API sebelumnya diterjemahkan ke:
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
Permintaan untuk mengonfigurasi cadangan
Untuk membuat instans cadangan, gunakan komponen berikut dalam isi permintaan:
| Nama | Tipe | Deskripsi |
|---|---|---|
properties |
BackupInstance |
BackupInstanceResource properti |
Contoh permintaan berikut menggunakan isi permintaan yang sama dengan yang Anda gunakan untuk memvalidasi permintaan cadangan, dengan nama unik:
{
"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"
}
}
Respons untuk mengonfigurasi permintaan cadangan
Membuat permintaan instans cadangan adalah operasi asinkron. Jadi, operasi ini akan menciptakan operasi lain yang perlu dilacak secara terpisah.
Operasi mengembalikan respons ini:
| Nama | Tipe | Deskripsi |
|---|---|---|
201 Created |
Instans cadangan | Instans cadangan dibuat, dan perlindungan dikonfigurasi. |
200 OK |
Instans cadangan | Perlindungan telah dikonfigurasi. |
| Kode status lainnya | CloudError | Respons kesalahan menjelaskan mengapa operasi gagal. |
Setelah Anda mengirimkan PUT permintaan untuk membuat instans cadangan, respons awal adalah 201 Created dengan Azure-asyncOperation header. Dalam contoh berikut, perhatikan bahwa isi permintaan berisi semua properti instans cadangan:
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"
}
Lacak operasi yang dihasilkan dengan menggunakan Azure-AsyncOperation header dengan perintah sederhana GET :
GET https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/providers/Microsoft.DataProtection/locations/westus/operationStatus/ZmMzNDFmYWMtZWJlMS00NGJhLWE4YTgtMDNjYjI4Y2M5OTExOzI1NWUwNmFlLTI5MjUtNDBkNy1iMjMxLTM0ZWZlMDA3NjdkYQ==?api-version=2021-01-01
Setelah operasi selesai, 200 OK akan dikembalikan dengan pesan Succeeded dalam isi respons:
{
"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"
}
Hentikan perlindungan dan hapus data
Untuk menghapus perlindungan pada database PostgreSQL dan menghapus data cadangan, lakukan operasi DELETE:
DELETE https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}?api-version=2021-01-01
Misalnya, API sebelumnya diterjemahkan ke:
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"
Respons untuk menghentikan perlindungan dan menghapus data
DELETE adalah operasi asinkron. Jadi, operasi ini akan menciptakan operasi lain yang perlu dilacak secara terpisah.
Operasi mengembalikan respons ini:
| Nama | Tipe | Deskripsi |
|---|---|---|
200 OK |
Operasi selesai. | |
202 Accepted |
Operasi diterima. Operasi lain dibuat. |
Setelah Anda mengirimkan permintaan DELETE, respons awal adalah 202 Accepted dengan header Azure-asyncOperation, seperti yang ditunjukkan dalam contoh respons ini.
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
Lacak Azure-AsyncOperation header dengan GET permintaan sederhana. Ketika permintaan berhasil, ini mengembalikan respons status 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"
}
Konten terkait
- Pulihkan database PostgreSQL dengan menggunakan REST API Perlindungan Data.
- Pulihkan database PostgreSQL menggunakan portal Microsoft Azure, Azure PowerShell, dan Azure CLI.
- REST API Perlindungan Data Backup Azure.
- Referensi Azure REST API.
- Lacak pekerjaan pencadangan dan pemulihan dengan menggunakan REST API di Azure Backup.
- Mengelola server Azure Database for PostgreSQL dengan menggunakan portal Microsoft Azure.