Skip to content

Commit 79aa550

Browse files
minor changes
1 parent 99f4dad commit 79aa550

File tree

3 files changed

+113
-111
lines changed

3 files changed

+113
-111
lines changed

articles/backup/backup-postgresql-cli.md

Lines changed: 113 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Back up Azure Database for PostgreSQL with long-term-retention using Azure CLI
33
description: Learn how to back up Azure Database for PostgreSQL using Azure CLI.
44
ms.topic: conceptual
5-
ms.date: 01/24/2022
5+
ms.date: 02/25/2022
66
ms.custom: devx-track-azurecli
77
author: v-amallick
88
ms.service: backup
@@ -318,132 +318,134 @@ az dataprotection backup-instance create --resource-group testBkpVaultRG --vault
318318

319319
You have to specify a retention rule while you trigger backup. To view the retention rules in policy, navigate through the policy JSON file for retention rules. In the following example, there are two retention rules with names **Default** and **Monthly**. We'll use the **Monthly** rule for the on-demand backup.
320320

321-
```azurecli
322-
az dataprotection backup-policy show -g ossdemorg --vault-name ossdemovault-1 --subscription e3d2d341-4ddb-4c5d-9121-69b7e719485e --name osspol5
323-
{
324-
"id": "/subscriptions/e3d2d341-4ddb-4c5d-9121-69b7e719485e/resourceGroups/ossdemorg/providers/Microsoft.DataProtection/backupVaults/ossdemovault-1/backupPolicies/osspol5",
325-
"name": "osspol5",
326-
"properties": {
327-
"datasourceTypes": [
328-
"Microsoft.DBforPostgreSQL/servers/databases"
329-
],
330-
"objectType": "BackupPolicy",
331-
"policyRules": [
332-
{
333-
"backupParameters": {
334-
"backupType": "Full",
335-
"objectType": "AzureBackupParams"
336-
},
337-
"dataStore": {
338-
"dataStoreType": "VaultStore",
339-
"objectType": "DataStoreInfoBase"
340-
},
341-
"name": "BackupWeekly",
342-
"objectType": "AzureBackupRule",
343-
"trigger": {
344-
"objectType": "ScheduleBasedTriggerContext",
345-
"schedule": {
346-
"repeatingTimeIntervals": [
347-
"R/2020-04-04T20:00:00+00:00/P1W",
348-
"R/2020-04-01T20:00:00+00:00/P1W"
349-
],
350-
"timeZone": "UTC"
351-
},
352-
"taggingCriteria": [
321+
```azurecli
322+
az dataprotection backup-policy show -g ossdemorg --vault-name ossdemovault-1 --subscription e3d2d341-4ddb-4c5d-9121-69b7e719485e --name osspol5
323+
{
324+
"id": "/subscriptions/e3d2d341-4ddb-4c5d-9121-69b7e719485e/resourceGroups/ossdemorg/providers/Microsoft.DataProtection/backupVaults/ossdemovault-1/backupPolicies/osspol5",
325+
"name": "osspol5",
326+
"properties": {
327+
"datasourceTypes": [
328+
"Microsoft.DBforPostgreSQL/servers/databases"
329+
],
330+
"objectType": "BackupPolicy",
331+
"policyRules": [
332+
{
333+
"backupParameters": {
334+
"backupType": "Full",
335+
"objectType": "AzureBackupParams"
336+
},
337+
"dataStore": {
338+
"dataStoreType": "VaultStore",
339+
"objectType": "DataStoreInfoBase"
340+
},
341+
"name": "BackupWeekly",
342+
"objectType": "AzureBackupRule",
343+
"trigger": {
344+
"objectType": "ScheduleBasedTriggerContext",
345+
"schedule": {
346+
"repeatingTimeIntervals": [
347+
"R/2020-04-04T20:00:00+00:00/P1W",
348+
"R/2020-04-01T20:00:00+00:00/P1W"
349+
],
350+
"timeZone": "UTC"
351+
},
352+
"taggingCriteria": [
353+
{
354+
"criteria": [
353355
{
354-
"criteria": [
355-
{
356-
"absoluteCriteria": [
357-
"FirstOfMonth"
358-
],
359-
"daysOfMonth": null,
360-
"daysOfTheWeek": null,
361-
"monthsOfYear": null,
362-
"objectType": "ScheduleBasedBackupCriteria",
363-
"scheduleTimes": null,
364-
"weeksOfTheMonth": null
365-
}
356+
"absoluteCriteria": [
357+
"FirstOfMonth"
366358
],
367-
"isDefault": false,
368-
"tagInfo": {
369-
"eTag": null,
370-
"id": "Monthly_",
371-
"tagName": "Monthly"
372-
},
373-
"taggingPriority": 15
374-
},
375-
{
376-
"criteria": null,
377-
"isDefault": true,
378-
"tagInfo": {
379-
"eTag": null,
380-
"id": "Default_",
381-
"tagName": "Default"
382-
},
383-
"taggingPriority": 99
359+
"daysOfMonth": null,
360+
"daysOfTheWeek": null,
361+
"monthsOfYear": null,
362+
"objectType": "ScheduleBasedBackupCriteria",
363+
"scheduleTimes": null,
364+
"weeksOfTheMonth": null
384365
}
385-
]
366+
],
367+
"isDefault": false,
368+
"tagInfo": {
369+
"eTag": null,
370+
"id": "Monthly_",
371+
"tagName": "Monthly"
372+
},
373+
"taggingPriority": 15
374+
},
375+
{
376+
"criteria": null,
377+
"isDefault": true,
378+
"tagInfo": {
379+
"eTag": null,
380+
"id": "Default_",
381+
"tagName": "Default"
382+
},
383+
"taggingPriority": 99
386384
}
387-
},
388-
{
389-
"isDefault": false,
390-
"lifecycles": [
391-
{
392-
"deleteAfter": {
393-
"duration": "P10Y",
394-
"objectType": "AbsoluteDeleteOption"
395-
},
396-
"sourceDataStore": {
397-
"dataStoreType": "VaultStore",
398-
"objectType": "DataStoreInfoBase"
399-
},
400-
"targetDataStoreCopySettings": []
401-
}
402-
],
403-
"name": "Monthly",
404-
"objectType": "AzureRetentionRule"
405-
},
385+
]
386+
}
387+
},
388+
{
389+
"isDefault": false,
390+
"lifecycles": [
406391
{
407-
"isDefault": true,
408-
"lifecycles": [
409-
{
410-
"deleteAfter": {
411-
"duration": "P1Y",
412-
"objectType": "AbsoluteDeleteOption"
413-
},
414-
"sourceDataStore": {
415-
"dataStoreType": "VaultStore",
416-
"objectType": "DataStoreInfoBase"
417-
},
418-
"targetDataStoreCopySettings": []
419-
}
420-
],
421-
"name": "Default",
422-
"objectType": "AzureRetentionRule"
392+
"deleteAfter": {
393+
"duration": "P10Y",
394+
"objectType": "AbsoluteDeleteOption"
395+
},
396+
"sourceDataStore": {
397+
"dataStoreType": "VaultStore",
398+
"objectType": "DataStoreInfoBase"
399+
},
400+
"targetDataStoreCopySettings": []
423401
}
424-
]
402+
],
403+
"name": "Monthly",
404+
"objectType": "AzureRetentionRule"
425405
},
426-
"resourceGroup": "ossdemorg",
427-
"systemData": null,
428-
"type": "Microsoft.DataProtection/backupVaults/backupPolicies"
429-
}
430-
```
406+
{
407+
"isDefault": true,
408+
"lifecycles": [
409+
{
410+
"deleteAfter": {
411+
"duration": "P1Y",
412+
"objectType": "AbsoluteDeleteOption"
413+
},
414+
"sourceDataStore": {
415+
"dataStoreType": "VaultStore",
416+
"objectType": "DataStoreInfoBase"
417+
},
418+
"targetDataStoreCopySettings": []
419+
}
420+
],
421+
"name": "Default",
422+
"objectType": "AzureRetentionRule"
423+
}
424+
]
425+
},
426+
"resourceGroup": "ossdemorg",
427+
"systemData": null,
428+
"type": "Microsoft.DataProtection/backupVaults/backupPolicies"
429+
}
430+
```
431+
432+
### Trigger an on-demand backup using command
431433

432-
To trigger an on-demand backup, use the [az dataprotection backup-instance adhoc-backup](/cli/azure/dataprotection/backup-instance#az_dataprotection_backup_instance_adhoc_backup) command.
434+
Trigger an on-demand backup using the [az dataprotection backup-instance adhoc-backup](/cli/azure/dataprotection/backup-instance#az_dataprotection_backup_instance_adhoc_backup) command.
433435

434-
```azurecli
435-
az dataprotection backup-instance adhoc-backup --name "ossrg-empdb11" --rule-name "Monthly" --resource-group testBkpVaultRG --vault-name TestBkpVault
436-
```
436+
```azurecli
437+
az dataprotection backup-instance adhoc-backup --name "ossrg-empdb11" --rule-name "Monthly" --resource-group testBkpVaultRG --vault-name TestBkpVault
438+
```
437439

438440
## Track jobs
439441

440442
Track all jobs using the [az dataprotection job list](/cli/azure/dataprotection/job#az_dataprotection_job_list) command. You can list all jobs and fetch a particular job detail.
441443

442444
You can also use _Az.ResourceGraph_ to track all jobs across all Backup vaults. Use the [az dataprotection job list-from-resourcegraph](/cli/azure/dataprotection/job#az_dataprotection_job_list_from_resourcegraph) command to fetch the relevant jobs that are across Backup vaults.
443445

444-
```azurecli
445-
az dataprotection job list-from-resourcegraph --datasource-type AzureDatabaseForPostgreSQL --status Completed
446-
```
446+
```azurecli
447+
az dataprotection job list-from-resourcegraph --datasource-type AzureDatabaseForPostgreSQL --status Completed
448+
```
447449

448450
## Next steps
449451

-3 Bytes
Loading
-3 Bytes
Loading

0 commit comments

Comments
 (0)