About This Page
This page is part of the Azure documentation. It contains code examples and configuration instructions for working with Azure services.
Bias Analysis
Bias Types:
⚠️
powershell_heavy
⚠️
windows_first
⚠️
missing_linux_example
Summary:
The documentation page exhibits a Windows bias in several ways. Although the main focus is on Azure CLI (which is cross-platform), the explanations and object model discussions repeatedly reference PowerShell as the default or primary method for managing backup policies. File path examples (e.g., .\OSSPolicy.json) use Windows-style backslashes, and there are no explicit Linux or macOS command-line examples or file path conventions. The documentation describes PowerShell object manipulation in detail, but only briefly mentions that Azure CLI users must use files, without providing Linux-specific guidance or examples. There is also a tendency to mention PowerShell and Windows-centric approaches before or instead of Linux equivalents.
Recommendations:
- Provide explicit Linux/macOS shell examples alongside or instead of Windows/PowerShell examples, especially for file paths (e.g., use ./OSSPolicy.json instead of .\OSSPolicy.json).
- When discussing object manipulation, offer parity in explanation for both PowerShell (objects) and CLI (JSON/files), including sample jq or sed commands for Linux users.
- Avoid referring to PowerShell as the 'default' or primary method; instead, present both PowerShell and CLI approaches neutrally.
- Include notes or callouts for Linux/macOS users regarding file path conventions, shell differences, and any required environment setup.
- Where possible, use cross-platform syntax in examples, or provide both Windows and Linux variants.
Create pull request
Flagged Code Snippets
## Create a backup policy
After you create a vault, you can create a backup policy to help protect PostgreSQL databases. You can also [create a backup policy for PostgreSQL databases using REST API](backup-azure-data-protection-use-rest-api-create-update-postgresql-policy.md).
### Understand the PostgreSQL backup policy
Whereas disk backup offers multiple backups per day and blob backup is a *continuous* backup with no trigger, PostgreSQL backup offers archive protection. The backup data that's first sent to the vault can be moved to the archive tier in accordance with a defined rule or a life cycle.
In this context, the following hierarchy can help you understand the backup policy object for PostgreSQL:
- Policy rule
- Backup rule
- Backup parameter
- Backup type (a full database backup in this case)
- Initial datastore (where the backups land initially)
- Trigger (how the backup is triggered)
- Schedule
- Default tagging criteria (a default tag that links all scheduled backups to the retention rule)
- Default retention rule (a rule that's applied to all backups, by default, on the initial datastore)
The policy object defines what types of backups are triggered, how they're triggered (via a schedule), what they're tagged with, where they land (a datastore), and the life cycle of their data in a datastore.
The default PowerShell object for PostgreSQL says to trigger a *full* backup every week. The backups reach the vault, where they're stored for three months.
If you want to add the archive tier to the policy, you have to decide when the data will be moved from the vault to the archive, how long the data will stay in the archive, and which of the scheduled backups should be tagged as archivable. You have to add a retention rule that defines the life cycle of the backup data from the vault datastore to the archive datastore. The retention rule also defines how long the backup data will stay in the archive datastore. Then you need to add a tag that marks the scheduled backups as eligible to be archived.
The resultant PowerShell object is as follows:
- Policy rule
- Backup rule
- Backup parameter
- Backup type (a full database backup in this case)
- Initial datastore (where the backups land initially)
- Trigger (how the backup is triggered)
- Schedule
- Default tagging criteria (a default tag that links all the scheduled backups to the retention rule)
- New tagging criteria for the new retention rule with the same name
- Default retention rule (a rule that's applied to all backups, by default, on the initial datastore)
- New retention rule
- Life cycle
- Source datastore
- Time period for deletion in the source datastore
- Copy to the target datastore
### Retrieve the policy template
To understand the inner components of a backup policy for PostgreSQL database backup, retrieve the policy template by using the [`az dataprotection backup-policy get-default-policy-template`](/cli/azure/dataprotection/backup-policy#az-dataprotection-backup-policy-get-default-policy-template) command. This command returns the default policy template for a data-source type. Use this policy template to create a new policy.