Create a lifecycle management rule
The container where you store your backups will grow indefinitely over time, so its a good idea to add a lifecycle management rule on the backup container to purge old backups. This rule ensures that the container doesn't retain any backup data older than x number of days to keep your storage costs down.
To create this rule, you can run the following PowerShell script. You'll need to do this for every storage account where you are running backups.
Download the script and set the parameters at the top of the script:
azSubscription (the name of the Azure subscription)
resourceGroupName (the name of the resource group containing the storage account)
storageAccountName (the name of the storage account containing the storage tables being backed up)
retentionPeriod (the number of days you want to retain backup data for)
backupContainername (the name of the container where the backups are stored)
ruleName (the name of the rule you are creating)
After a successful execution of the script, you'll find the rule created in the storage account under Lifecycle management in the portal.
The rule uses a filter so that it applies only to the tablebackups container, and not any other containers, and will purge any backups older than the date you defined in the script.
Last updated