Skip to content

Enable soft delete for workspace backup Recovery Services vaults#4907

Open
Copilot wants to merge 5 commits into
mainfrom
copilot/fix-recovery-service-vault-deployment
Open

Enable soft delete for workspace backup Recovery Services vaults#4907
Copilot wants to merge 5 commits into
mainfrom
copilot/fix-recovery-service-vault-deployment

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 21, 2026

What is being addressed

Workspace creation with backup enabled can fail when the workspace backup Recovery Services Vault is created with soft delete disabled. Azure now requires soft delete to be enabled for new vaults, so attempts to create the vault with soft_delete_enabled = false can be rejected and leave the workspace deployment stuck.

This change also needs to preserve current workspace delete behavior so backup-related resources do not block cleanup.

How is this addressed

  • Recovery Services Vault configuration

    • Keep the workspace backup vault on azurerm_recovery_services_vault
    • Set soft_delete_enabled = true explicitly for the workspace backup vault
    • Preserve the existing Zone Redundant storage configuration
    • Preserve the existing CMK configuration on the AzureRM vault resource
  • Delete behavior

    • Configure the workspace base AzureRM provider recovery_service features to purge protected items from the vault on destroy
    • Set vm_backup_stop_protection_and_retain_data_on_destroy = false so workspace cleanup continues to remove backup data rather than retaining it
  • Provider/version updates

    • Update the workspace base AzureRM provider pin from 4.57.0 to 4.73.0 (latest)
    • Update the workspace base Terraform lock file to match the pinned AzureRM provider version
  • Template/versioning

    • Keep tre-workspace-base at 2.8.4
    • Update CHANGELOG.md to describe the AzureRM soft-delete-based fix
resource "azurerm_recovery_services_vault" "vault" {
  name                = local.vault_name
  location            = var.location
  resource_group_name = var.resource_group_name
  sku                 = "Standard"
  soft_delete_enabled = true
  storage_mode_type   = "ZoneRedundant"
  tags                = var.tre_workspace_tags
}

Copilot AI changed the title [WIP] Fix workspace deployment failure on Recovery Service Vault Use AzAPI for workspace backup Recovery Services vault creation May 21, 2026
Copilot AI requested a review from marrobi May 21, 2026 15:23
@marrobi
Copy link
Copy Markdown
Member

marrobi commented May 21, 2026

@copilot no, dont use azapi:

Enabling soft delete does not prevent you from deleting the Backup Vault itself, as long as there are no protected (or soft‑deleted) backup items still in it.
What's actually happening
Azure now requires soft delete to be enabled on Microsoft.DataProtection/BackupVaults — the API rejects vaults created with soft_delete = "Off". That's why your azurerm_data_protection_backup_vault deploy is failing. The supported values are:
• AlwaysOn – soft delete enabled and immutable (cannot be turned off). ⚠️ This makes the vault very hard to remove.
• On – soft delete enabled (default) but can be disabled later. ✅ Safe choice.
• Off – no longer accepted by the platform for new vaults.

So set it explicitly to on. But consider side effects and need to maintain current functionality. Also ensure the azureRm provider is the latest release (pinned).

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 21, 2026

@copilot no, dont use azapi:

Enabling soft delete does not prevent you from deleting the Backup Vault itself, as long as there are no protected (or soft‑deleted) backup items still in it....

Addressed in 3d11658. The vault is back on AzureRM, soft_delete_enabled is set to true, the workspace base AzureRM pin/lock were updated to 4.58.0, and the provider now enables recovery_service.purge_protected_items_from_vault_on_destroy with non-retaining VM cleanup so workspace deletes keep the expected behavior.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • checkpoint-api.hashicorp.com
    • Triggering command: /tmp/terraform-bin/terraform /tmp/terraform-bin/terraform fmt -check -recursive (dns block)
    • Triggering command: /tmp/terraform-bin/terraform /tmp/terraform-bin/terraform -chdir=templates/workspaces/base/terraform init -backend=false -upgrade (dns block)
    • Triggering command: /tmp/terraform-bin/terraform /tmp/terraform-bin/terraform -chdir=templates/workspaces/base/terraform validate (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Use AzAPI for workspace backup Recovery Services vault creation Enable soft delete for workspace backup Recovery Services vaults May 21, 2026
Comment thread templates/workspaces/base/terraform/providers.tf Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the workspace base Terraform template to comply with Azure’s requirement that soft delete is enabled on newly created Recovery Services Vaults, while preserving current workspace deletion/cleanup behavior by ensuring protected items are purged on destroy.

Changes:

  • Enable soft_delete_enabled = true for the workspace backup azurerm_recovery_services_vault.
  • Configure AzureRM provider recovery_service features to purge protected items and avoid retaining VM backup data on destroy.
  • Bump the workspace base AzureRM provider pin/lockfile to 4.58.0 and update the template version + changelog entry.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
templates/workspaces/base/terraform/providers.tf Bumps AzureRM to 4.58.0 and configures provider recovery services destroy behavior.
templates/workspaces/base/terraform/backup/backup.tf Enables soft delete on the workspace backup Recovery Services Vault.
templates/workspaces/base/terraform/.terraform.lock.hcl Updates AzureRM provider lock to 4.58.0 and corresponding hashes.
templates/workspaces/base/porter.yaml Bumps tre-workspace-base bundle version to 2.8.4.
CHANGELOG.md Documents the fix under BUG FIXES.
Files not reviewed (1)
  • templates/workspaces/base/terraform/.terraform.lock.hcl: Language not supported

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 21, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • checkpoint-api.hashicorp.com
    • Triggering command: ./terraform ./terraform version (dns block)
    • Triggering command: /tmp/terraform /tmp/terraform providers lock -platform=linux_amd64 -platform=linux_arm64 -platform=darwin_amd64 -platform=darwin_arm64 -platform=windows_amd64 hashicorp/azurerm (dns block)
    • Triggering command: /tmp/terraform /tmp/terraform fmt -check -recursive (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from marrobi May 21, 2026 18:02
@marrobi
Copy link
Copy Markdown
Member

marrobi commented May 21, 2026

/test-extended 43c865c

@github-actions
Copy link
Copy Markdown

🤖 pr-bot 🤖

🏃 Running extended tests: https://github.com/microsoft/AzureTRE/actions/runs/26244326090 (with refid 14403c22)

(in response to this comment from @marrobi)

@rudolphjacksonm rudolphjacksonm marked this pull request as ready for review May 21, 2026 20:07
@rudolphjacksonm rudolphjacksonm requested a review from a team as a code owner May 21, 2026 20:07
@rudolphjacksonm
Copy link
Copy Markdown
Collaborator

/test 844071f

@github-actions
Copy link
Copy Markdown

🤖 pr-bot 🤖

🏃 Running tests: https://github.com/microsoft/AzureTRE/actions/runs/26250270305 (with refid 14403c22)

(in response to this comment from @rudolphjacksonm)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Workspace deployment fails on Recovery Service Vault - TF Provider issue.

4 participants