terraform-provider-azurerm icon indicating copy to clipboard operation
terraform-provider-azurerm copied to clipboard

Support for Immutable vaults in Azure Backup Vault

Open mfatbmw opened this issue 2 years ago • 6 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Community Note

  • Please vote on this issue by adding a :thumbsup: reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Azure Backup provides an option to ensure that recovery points that are once created cannot be deleted before their intended expiry time. Azure Backup does this by preventing any operations which could lead to loss of backup data. Hence, this helps you protect backups against threats like ransomware attacks and malicious actors by disallowing operations such as deleting backups or reducing retention in backup policies.

New or Affected Resource(s)/Data Source(s)

azurerm_data_protection_backup_vault

Potential Terraform Configuration

resource "azurerm_resource_group" "example" {
  name     = "example-resources"
  location = "West Europe"
}

resource "azurerm_data_protection_backup_vault" "example" {
  name                = "example-backup-vault"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location
  datastore_type      = "VaultStore"
  redundancy          = "LocallyRedundant"
  
  immutability        = "Locked" or "Unlocked" or "Disabled"
   
}

References

https://learn.microsoft.com/en-us/azure/backup/backup-azure-immutable-vault-how-to-manage?tabs=backup-vault

mfatbmw avatar Jun 21 '23 16:06 mfatbmw

@mfatbmw Yes, this needs to be there !! Also please note I coud not find any doc for enable_soft_delete and retention_period_days? Am I mssing something ? I believe those are in preview feature as per the ARM Template Resource definition.

image

RSwarnkar avatar Oct 26 '23 10:10 RSwarnkar

@mfatbmw - I'm expiancing an error regarding immutability of an recovery service vault and the corrisponding backup policy. The scenario is as following:

  • Immuability is enabled but unlocked
  • Daily retention is set to 7 days
  • Increasing the retention time via the portal is working
  • Decreasing the retention time via the portal is denied (as it should be)

I get the following error when I want to increase the retention time from 7 to 8 days:

Backup Policy Name: "StandardVMBackupPolicy"): protectionpolicies.ProtectionPoliciesClient#CreateOrUpdate: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="UserErrorModifyPolicyOrProtectionWithReducedRetentionNotSupported" Message="Reduction in retention during Policy/Protection modification is not allowed since the selected vault is immutable. Kindly ensure that the policy/protection modification involves only same retention or retention increase for an immutable vault."

pkosiol-cc avatar Feb 13 '24 10:02 pkosiol-cc

Any update on this topic ?

giovannifl avatar Mar 19 '24 15:03 giovannifl

Any update?

frazhamid avatar May 23 '24 06:05 frazhamid

save2 save1 @mfatbmw Hi, I'm trying from azurerm version "3.112.0". Getting error for enabling immutability property from terraform.

Pree-Y avatar Jul 31 '24 14:07 Pree-Y

Any news on this? This feature is still not in the azurerm_data_protection_backup_vault and we have to manually set this every time. Feels weird that such a basic feature is overlooked for over a year.

rdvansloten avatar Aug 29 '24 09:08 rdvansloten

We need immutability support for backup vault!!!

Skyb0rg avatar Oct 22 '24 13:10 Skyb0rg

Hello, in effect, we need immutability support for backup vault.

It's possible to use azapi until this feature is not available:

resource "azapi_update_resource" "main_immutability" {
  resource_id = azurerm_data_protection_backup_vault.main.id
  type        = "Microsoft.DataProtection/backupVaults@2024-04-01"
  body = {
    properties = {
      securitySettings = {
        immutabilitySettings = {
          state = "Unlocked"
        }
      }
    }
  }
}

BenoitNgs avatar Oct 25 '24 12:10 BenoitNgs

Thank You @BenoitNgs !!! Works perfect for the moment.

Skyb0rg avatar Oct 28 '24 16:10 Skyb0rg

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

github-actions[bot] avatar Feb 15 '25 02:02 github-actions[bot]