Hello @admin Alchemy Thank you for reaching out to us on Microsoft Q&A platform. Happy to assist!
To set a backup policy for 7 years for your PostgreSQL database backup through Azure Backup, you can modify the retention rule of the policy template. By default, the retention rule is set to retain each backup for three months**.**
Here's an example of how to modify the retention rule to retain backups for 7 years:
{
"name": "Monthly",
"objectType": "AzureRetentionRule",
"isDefault": true,
"lifecycles": [
{
"deleteAfter": {
"duration": "P7Y",
"objectType": "AbsoluteDeleteOption"
},
"sourceDataStore": {
"dataStoreType": "VaultStore",
"objectType": "DataStoreInfoBase"
},
"targetDataStoreCopySettings": []
}
]
}
In this example, the retention rule is set to retain each backup for 7 years. You can modify the duration to any value you want. Once you have modified the retention rule, you can create or update the backup policy using the Azure Backup REST API.
Doc ref: https://learn.microsoft.com/en-us/azure/backup/backup-azure-database-postgresql
Let me know if you need more information on how to create or update the backup policy.
If the response helped, do "Accept Answer" and up-vote it