The Delete Disk Snapshots action can be used to delete many Azure disk snapshots based on specific criteria. Possible criteria includes the snapshot name and resource group name.
For example, it can be used to:
- delete all snapshots
- delete all snapsnots older than 7 days
- delete only snapshots that contain "backup" in it's name.
- delete snapshots that contain "backup" in it's name and are older than 5 days
The Delete Disk Snapshots action includes a "test mode" as a way of determining which snapshots will be deleted without actually deleting the snapshots. This way, you can fine tune your action without concern for deleting the wrong snapshots. Test Mode is on by default.
When test mode is enabled, execute your action normally then check the action logs to verify that only snapshots that should have been deleted would have been deleted, and that snapshots that should not have been deleted would not have been deleted.
When you are satisfied, disable Test Mode.
Please see Common Action Settings for a description of settings common to all action types.
Indicates the resource groups in which snapshots may be deleted. Valid options include:
- Any resource group - Snapshots in any resource group may be deleted
- Select resource groups by name - Snapshots in resource groups with matching names may be deleted
Resource Group Name
Comparison used when matching resource group names. Comparison is not case-sensitive.
Indicates the snapshot names for snapshots which may be deleted. Valid options include:
- Any snapshot name - Snapshots with any name may be deleted
- Select snapshots by name - Snapshots with matching names may be deleted
Comparison used when matching snapshot names. Comparison is case-sensitive.
Compare Resource Tags
Indicates whether resource tags are compared. Only snapshots with matching resource tags may be deleted.
Resource Tag Name
Indicates the name of the resource tag used to compare.
Resource Tag Value
Indicates the value of the resource tag used to compare.
Indicates the deletion scheme used to decide if snapshots should be deleted or preserved. Options include:
- Delete All Snapshots - All snapshots selected will be deleted.
- Simple, Oldest First - Older snapshots will be deleted based on age, newer snapshots will be preserved.
- Grandfather-Father-Son - Snapshots will be preserved based on a minimum number of daily, weekly, monthly, and yearly snapshots.
Only snapshots older than the specified number of days will be deleted.
Minimum To Keep
Indicates the minimum number of snapshots to keep. Newer snapshots are favoured to keep over older snapshots.
When enabled, the action groups snapshots together and apply delete scheme on each group independently. Possible options include:
- None - No grouping will occur.
- By Source Disk- Snapshots will be grouped based on the source disk.
- By Resource Tag - Snapshots will be grouped based on the value of a specified resource tag.
Grouping Resource Tag Name
Name of the resource tag to use to group snapshots.
Enables and disables Test Mode (see above).
Azure Commands Used
The following Azure commands are used. The credential should have permission to execute all of them.