Review Azure Backup Vault immutability

Use immutability in Azure Backup Vault to reduce the risk of losing backups before their retention period expires.

Description

Immutability prevents early deletion of recovery points stored in the Backup vault. Operational backups of blobs, files and disks are outside this protection.

Potential impact

If immutability is off, a user with deletion rights can accidentally or deliberately remove backups. If the source data is also lost, you may have no recovery point.

Remediation

  • First enable protection with immutability = "Unlocked". You can still turn it off while you check retention policies, test backup and restore, and review the effect on operations.
  • Once those checks pass, consider Locked. The lock is irreversible. Keep soft delete and least-privilege access in place.

Examples

The examples use different vault names. When updating an existing vault, keep its actual name. A name change creates a new vault. Check the Terraform plan for replacement.

Before

hcl
resource "azurerm_data_protection_backup_vault" "backup_vault" {
  name                = "app-backup-vault"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location
  datastore_type      = "VaultStore"
  redundancy          = "LocallyRedundant"
  immutability        = "Disabled"
}

After

hcl
resource "azurerm_data_protection_backup_vault" "backup_vault" {
  name                = "protected-backup-vault"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location
  datastore_type      = "VaultStore"
  redundancy          = "LocallyRedundant"
  immutability        = "Locked"
}

References