Skip to content

Commit 9c9d17f

Browse files
committed
edit pass: azure-database-for-postgresql-backup
1 parent c0cc8c7 commit 9c9d17f

File tree

2 files changed

+109
-133
lines changed

2 files changed

+109
-133
lines changed

articles/backup/backup-azure-data-protection-use-rest-api-backup-postgresql.md

Lines changed: 51 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ After you create the vault and policy, you need to consider three critical point
2828

2929
#### PostgreSQL database to be backed up
3030

31-
Fetch the 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.
31+
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.
3232

3333
```http
3434
"/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx/resourcegroups/ossdemoRG/providers/Microsoft.DBforPostgreSQL/servers/testpostgresql/databases/empdb11"
@@ -46,13 +46,13 @@ The following example uses Bash. Note the secret identifier of the relevant key.
4646

4747
#### Backup vault
4848

49-
A backup vault has to connect to the PostgreSQL server, and then access the database via the keys present in the key vault. So, it requires access to PostgreSQL server and the key vault. Access is granted to the backup vault's managed identity.
49+
A backup vault has to connect to the PostgreSQL server and then access the database via the keys present in the key vault. So, it requires access to the PostgreSQL server and the key vault. Access is granted to the backup vault's managed identity.
5050

51-
You need to grant permissions to the backup vault's managed identity on the PostgreSQL server and the key vault, where the keys to the database are stored. [Learn more](./backup-azure-database-postgresql-overview.md#set-of-permissions-needed-for-azure-postgresql-database-backup).
51+
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](./backup-azure-database-postgresql-overview.md#set-of-permissions-needed-for-azure-postgresql-database-backup).
5252

5353
### Prepare the request
5454

55-
After you set the relevant permissions to the vault and PostgreSQL database, and configure the vault and policy, prepare the request to configure backup. See the following request body to configure backup for a PostgreSQL database. The Azure Resource Manager ID (ARM ID) of the PostgreSQL database and its details are present in the _datasourceinfo_ section. The policy information is present in the _policyinfo_ section.
55+
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.
5656

5757
```json
5858
{
@@ -86,21 +86,21 @@ After you set the relevant permissions to the vault and PostgreSQL database, and
8686

8787
### Validate the request to configure backup
8888

89-
To validate if the request to configure backup will be successful, use the [validate for backup API](/rest/api/dataprotection/backup-instances/validate-for-backup). You can use the response to perform the required prerequisites, and then submit the configuration for the backup request.
89+
To validate if the request to configure backup will be successful, use the [Validate For Backup API](/rest/api/dataprotection/backup-instances/validate-for-backup). You can use the response to perform the required prerequisites, and then submit the configuration for the backup request.
9090

91-
Validate for backup request is a _POST_ operation and the Uniform Resource Identifier (URI) contains `{subscriptionId}`, `{vaultName}`, `{vaultresourceGroupName}` parameters.
91+
Validation of a backup request is a `POST` operation. The URI contains `{subscriptionId}`, `{vaultName}`, and `{vaultresourceGroupName}` parameters:
9292

9393
```http
9494
POST https://management.azure.com/Subscriptions/{subscriptionId}/resourceGroups/{vaultresourceGroupname}/providers/Microsoft.DataProtection/backupVaults/{backupVaultName}/validateForBackup?api-version=2021-01-01
9595
```
9696

97-
For example, this API translates to:
97+
For example, the preceding API translates to:
9898

9999
```http
100100
POST https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/TestBkpVaultRG/providers/Microsoft.DataProtection/backupVaults/testBkpVault/validateForBackup?api-version=2021-01-01
101101
```
102102

103-
The [request body](#prepare-the-request-to-configure-backup) that we prepared earlier will be used to provide details of the PostgreSQL database to be protected.
103+
The [request body](#prepare-the-request) that you prepared earlier provides details about the PostgreSQL database to be backed up.
104104

105105
#### Example request body
106106

@@ -138,19 +138,17 @@ The [request body](#prepare-the-request-to-configure-backup) that we prepared ea
138138

139139
Backup request validation is an [asynchronous operation](../azure-resource-manager/management/async-operations.md). So, this operation creates another operation that needs to be tracked separately.
140140

141-
It returns two responses: 202 (Accepted) when another operation is created, and 200 (OK) when that operation completes.
141+
The operation returns these responses:
142142

143143
|Name |Type |Description |
144144
|---------|---------|---------|
145-
|202 Accepted | | The operation will be completed asynchronously |
146-
|200 OK | [OperationJobExtendedInfo](/rest/api/dataprotection/backup-instances/validate-for-backup#operationjobextendedinfo) | Accepted |
147-
| Other Status codes | [CloudError](/rest/api/dataprotection/backup-instances/validate-for-backup#clouderror) | Error response describing why the operation failed |
145+
|`202 Accepted` | | Another operation is created. The operation will be completed asynchronously. |
146+
|`200 OK` | [`OperationJobExtendedInfo`](/rest/api/dataprotection/backup-instances/validate-for-backup#operationjobextendedinfo) | The operation is completed. |
147+
| Other status codes | [`CloudError`](/rest/api/dataprotection/backup-instances/validate-for-backup#clouderror) | The error response describes why the operation failed. |
148148

149-
##### Example responses for validate backup request
149+
##### Example error response
150150

151-
###### Error response
152-
153-
If the given disk is already protected, it returns the response as HTTP 400 (Bad request) and states that the given disk is protected to a backup vault along with details.
151+
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:
154152

155153
```http
156154
HTTP/1.1 400 BadRequest
@@ -198,9 +196,9 @@ X-Powered-By: ASP.NET
198196
}
199197
```
200198

201-
###### Track response
199+
##### Example tracking response
202200

203-
If the datasource is unprotected, then the API proceeds for further validations and creates a tracking operation.
201+
If the data source is unprotected, the API proceeds for further validations and creates a tracking operation:
204202

205203
```http
206204
HTTP/1.1 202 Accepted
@@ -221,7 +219,7 @@ Location: https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxx
221219
X-Powered-By: ASP.NET
222220
```
223221

224-
Track the resulting operation using the _Azure-AsyncOperation_ header with a simple *GET* command.
222+
Track the resulting operation by using the `Azure-AsyncOperation` header with a simple `GET` command:
225223

226224
```http
227225
GET https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/providers/Microsoft.DataProtection/locations/westus/operationStatus/ZmMzNDFmYWMtZWJlMS00NGJhLWE4YTgtMDNjYjI4Y2M5OTExOzM2NDdhZDNjLTFiNGEtNDU4YS05MGJkLTQ4NThiYjRhMWFkYg==?api-version=2021-01-01
@@ -235,7 +233,7 @@ GET https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx
235233
}
236234
```
237235

238-
It returns 200 (OK) once it completes and the response body lists further requirements to be fulfilled, such as permissions.
236+
The operation returns `200 OK` when it finishes. The response body then lists further requirements to be fulfilled, such as permissions:
239237

240238
```http
241239
GET https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/providers/Microsoft.DataProtection/locations/westus/operationStatus/ZmMzNDFmYWMtZWJlMS00NGJhLWE4YTgtMDNjYjI4Y2M5OTExOzM2NDdhZDNjLTFiNGEtNDU4YS05MGJkLTQ4NThiYjRhMWFkYg==?api-version=2021-01-01
@@ -277,7 +275,7 @@ GET https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx
277275
}
278276
```
279277

280-
If you grant all permissions, then resubmit the validate request, track the resulting operation. It'll return the success response as 200 (OK) if all the conditions are met.
278+
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.
281279

282280
```http
283281
GET https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/providers/Microsoft.DataProtection/locations/westus/operationStatus/ZmMzNDFmYWMtZWJlMS00NGJhLWE4YTgtMDNjYjI4Y2M5OTExOzlhMjk2YWM2LWRjNDMtNGRjZS1iZTU2LTRkZDNiMDhjZDlkOA==?api-version=2021-01-01
@@ -291,35 +289,33 @@ GET https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx
291289
}
292290
```
293291

294-
### Configure backup request
292+
### Configure a backup request
295293

296-
Once the request is validated, you can submit the same to the [create backup instance API](/rest/api/dataprotection/backup-instances/create-or-update). One of the Azure Backup data protection services protects the Backup instance within the backup vault. Here, the PostgreSQL database is the backup instance. Use the above-validated request body with minor additions.
294+
After the request is validated, you can submit the request to the [Create Backup Instance API](/rest/api/dataprotection/backup-instances/create-or-update). 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.
297295

298-
Use a unique name for the backup instance. So, we recommend you use a combination of the resource name and a unique identifier. For example, in the following operation, we'll use _testpostgresql-empdb11-957d23b1-c679-4c94-ade6-c4d34635e149_ and mark it as the backup instance name.
296+
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.
299297

300-
To create or update the backup instance, use the following ***PUT*** operation.
298+
To create or update the backup instance, use the following `PUT` operation:
301299

302300
```http
303301
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/{BkpvaultName}/backupInstances/{UniqueBackupInstanceName}?api-version=2021-01-01
304302
```
305303

306-
For example, this API translates to:
304+
For example, the preceding API translates to:
307305

308306
```http
309-
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
307+
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
310308
```
311309

312-
#### Create the request for configure backup
310+
#### Request for configuring a backup
313311

314-
To create a backup instance, following are the components of the request body:
312+
To create a backup instance, use the following components in the request body:
315313

316314
|Name |Type |Description |
317315
|---------|---------|---------|
318-
|properties | [BackupInstance](/rest/api/dataprotection/backup-instances/create-or-update#backupinstance) | BackupInstanceResource properties |
319-
320-
##### Example request for configure backup
316+
|`properties` | [`BackupInstance`](/rest/api/dataprotection/backup-instances/create-or-update#backupinstance) | `BackupInstanceResource` properties |
321317

322-
We'll use the [same request body that we used to validate the backup request](#configure-backup) with a unique name.
318+
The following example request uses the [same request body that you used to validate the backup request](#configure-backup), with a unique name:
323319

324320
```json
325321
{
@@ -354,21 +350,19 @@ We'll use the [same request body that we used to validate the backup request](#c
354350
}
355351
```
356352

357-
#### Responses to configure backup request
353+
#### Responses to configuring a backup request
358354

359-
_Create backup instance request_ is an [asynchronous operation](../azure-resource-manager/management/async-operations.md). So, this operation creates another operation that needs to be tracked separately.
355+
Creating a backup instance request is an [asynchronous operation](../azure-resource-manager/management/async-operations.md). So, this operation creates another operation that needs to be tracked separately.
360356

361-
It returns two responses: 201 (Created) when backup instance is created and the protection is configured. 200 (OK) when that configuration completes.
357+
The operation returns these responses:
362358

363359
|Name |Type |Description |
364360
|---------|---------|---------|
365-
|201 Created | [Backup instance](/rest/api/dataprotection/backup-instances/create-or-update#backupinstanceresource) | Backup instance is created and protection is being configured |
366-
|200 OK | [Backup instance](/rest/api/dataprotection/backup-instances/create-or-update#backupinstanceresource) | Protection is configured |
367-
| Other Status codes | [CloudError](/rest/api/dataprotection/backup-instances/validate-for-backup#clouderror) | Error response describing why the operation failed |
368-
369-
##### Example responses to configure backup request
361+
|`201 Created` | [Backup instance](/rest/api/dataprotection/backup-instances/create-or-update#backupinstanceresource) | The backup instance is created, and protection is configured. |
362+
|`200 OK` | [Backup instance](/rest/api/dataprotection/backup-instances/create-or-update#backupinstanceresource) | Protection is configured. |
363+
| Other status codes | [CloudError](/rest/api/dataprotection/backup-instances/validate-for-backup#clouderror) | The error responses describe why the operation failed. |
370364

371-
Once you submit the *PUT* request to create a backup instance, the initial response is 201 (Created) with an _Azure-asyncOperation_ header. Note that the request body contains all the backup instance properties.
365+
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:
372366

373367
```http
374368
HTTP/1.1 201 Created
@@ -427,13 +421,13 @@ X-Powered-By: ASP.NET
427421
}
428422
```
429423

430-
Then track the resulting operation using the _Azure-AsyncOperation_ header with a simple *GET* command.
424+
Track the resulting operation by using the `Azure-AsyncOperation` header with a simple `GET` command:
431425

432426
```http
433427
GET https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/providers/Microsoft.DataProtection/locations/westus/operationStatus/ZmMzNDFmYWMtZWJlMS00NGJhLWE4YTgtMDNjYjI4Y2M5OTExOzI1NWUwNmFlLTI5MjUtNDBkNy1iMjMxLTM0ZWZlMDA3NjdkYQ==?api-version=2021-01-01
434428
```
435429

436-
Once the operation completes, it returns 200 (OK) with the success message in the response body.
430+
When the operation finishes, it returns `200 OK` with the `Succeeded` message in the response body:
437431

438432
```json
439433
{
@@ -447,34 +441,30 @@ Once the operation completes, it returns 200 (OK) with the success message in th
447441

448442
### Stop protection and delete data
449443

450-
To remove the protection on a PostgreSQL database and delete the backup data as well, perform a [delete operation](/rest/api/dataprotection/backup-instances/delete).
451-
452-
Stopping protection and deleting data is a *DELETE* operation.
444+
To remove the protection on a PostgreSQL database and delete the backup data, perform a [DELETE operation](/rest/api/dataprotection/backup-instances/delete):
453445

454446
```http
455447
DELETE https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}?api-version=2021-01-01
456448
```
457449

458-
For example, this API translates to:
450+
For example, the preceding API translates to:
459451

460452
```http
461453
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"
462454
```
463455

464-
#### Responses for delete protection
456+
#### Responses for stopping protection and deleting data
465457

466-
*DELETE* protection is an [asynchronous operation](../azure-resource-manager/management/async-operations.md). So, this operation creates another operation that needs to be tracked separately.
458+
`DELETE` is an [asynchronous operation](../azure-resource-manager/management/async-operations.md). So, this operation creates another operation that needs to be tracked separately.
467459

468-
It returns two responses: 202 (Accepted) when another operation is created, and 200 (OK) when that operation completes.
460+
The operation returns these responses:
469461

470462
|Name |Type |Description |
471463
|---------|---------|---------|
472-
|200 OK | | Status of delete request |
473-
|202 Accepted | | Accepted |
474-
475-
##### Example responses for delete protection
464+
|`200 OK` | | The operation finished. |
465+
|`202 Accepted` | | The operation is accepted. Another operation is created. |
476466

477-
Once you submit the *DELETE* request, the initial response will be 202 (Accepted) with an _Azure-asyncOperation_ header.
467+
After you submit the `DELETE` request, the initial response is `202 Accepted` with an `Azure-asyncOperation` header, as shown in this example response:
478468

479469
```http
480470
HTTP/1.1 202 Accepted
@@ -495,7 +485,7 @@ Location: https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxx
495485
X-Powered-By: ASP.NET
496486
```
497487

498-
Track the _Azure-AsyncOperation_ header with a simple *GET* request. When the request is successful, it returns 200 (OK) with a success status response.
488+
Track the `Azure-AsyncOperation` header with a simple `GET` request. When the request is successful, it returns a `200 OK` status response.
499489

500490
```http
501491
GET "https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/providers/Microsoft.DataProtection/locations/westus/operationStatus/ZmMzNDFmYWMtZWJlMS00NGJhLWE4YTgtMDNjYjI4Y2M5OTExOzE1ZjM4YjQ5LWZhMGQtNDMxOC1iYjQ5LTExMDJjNjUzNjM5Zg==?api-version=2021-01-01"
@@ -511,7 +501,7 @@ GET "https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx
511501

512502
## Related content
513503

514-
- [Restore data from a PostGreSQL database backup](restore-postgresql-database-use-rest-api.md)
515-
- [Get started with Azure Data Protection Provider REST API](/rest/api/dataprotection/)
516-
- [Get started with Azure REST API](/rest/api/azure/)
517-
- [Manage backup jobs using REST API](backup-azure-arm-userestapi-managejobs.md).
504+
- [Restore PostgreSQL databases by using the Azure Data Protection REST API](restore-postgresql-database-use-rest-api.md)
505+
- [Azure Backup Data Protection REST API](/rest/api/dataprotection/)
506+
- [Azure REST API reference](/rest/api/azure/)
507+
- [Track backup and restore jobs by using the REST API in Azure Backup](backup-azure-arm-userestapi-managejobs.md)

0 commit comments

Comments
 (0)