Azure Recovery Services Container Storage Account

This page shows how to write Terraform and Azure Resource Manager for Recovery Services Container Storage Account and write them securely.

azurerm_backup_container_storage_account (Terraform)

The Container Storage Account in Recovery Services can be configured in Terraform with the resource name azurerm_backup_container_storage_account. The following sections describe 10 examples of how to use the resource and its parameters.

Example Usage from GitHub

backup_container.tf#L5
resource "azurerm_backup_container_storage_account" "container" {
  count = try(var.storage_account.backup, null) == null ? 0 : 1

  resource_group_name = local.recovery_vault.resource_group_name
  recovery_vault_name = local.recovery_vault.name
  storage_account_id  = azurerm_storage_account.stg.id
backup_container.tf#L5
resource "azurerm_backup_container_storage_account" "container" {
  count = try(var.storage_account.backup, null) == null ? 0 : 1

  resource_group_name = local.recovery_vault.resource_group_name
  recovery_vault_name = local.recovery_vault.name
  storage_account_id  = azurerm_storage_account.stg.id
backup_container.tf#L5
resource "azurerm_backup_container_storage_account" "container" {
  count = try(var.storage_account.backup, null) == null ? 0 : 1

  resource_group_name = local.recovery_vault.resource_group_name
  recovery_vault_name = local.recovery_vault.name
  storage_account_id  = azurerm_storage_account.stg.id
main.tf#L7
resource "azurerm_backup_container_storage_account" "this" {
  recovery_vault_name = var.recovery_vault_name
  resource_group_name = var.resource_group_name
  storage_account_id  = var.storage_account_id

  dynamic "timeouts" {
main.tf#L7
resource "azurerm_backup_container_storage_account" "this" {
  recovery_vault_name = var.recovery_vault_name
  resource_group_name = var.resource_group_name
  storage_account_id  = var.storage_account_id

  dynamic "timeouts" {
backup_container.tf#L8
resource "azurerm_backup_container_storage_account" "container" {

  for_each = try(var.storage_account.backup, null) == null ? toset([]) : toset(["enabled"])


  resource_group_name = local.recovery_vault.resource_group_name
backup.tf#L26
resource "azurerm_backup_container_storage_account" "container" {
  provider = azurerm.ScSc-PBMMCTOSandbox
  resource_group_name = data.azurerm_resource_group.rg-system.name
  recovery_vault_name = azurerm_recovery_services_vault.vault.name
  storage_account_id  = azurerm_storage_account.storageAccount.id
}
recovery_services_vault.tf#L17
resource "azurerm_backup_container_storage_account" "main" {
  for_each            = var.backup_storage_account
  resource_group_name = azurerm_resource_group.main[each.value.resource_group_key].name
  recovery_vault_name = azurerm_recovery_services_vault.main[each.value.recovery_vault_key].name
  storage_account_id  = azurerm_storage_account.main[each.key].id
}
backup.tf#L8
resource "azurerm_backup_container_storage_account" "protection-container" {
  resource_group_name = azurerm_resource_group.rg.name
  recovery_vault_name = azurerm_recovery_services_vault.vault.name
  storage_account_id  = azurerm_storage_account.valheim.id
}

backup_container.tf#L8
resource "azurerm_backup_container_storage_account" "container" {

  for_each = try(var.storage_account.backup, null) == null ? toset([]) : toset(["enabled"])


  resource_group_name = local.recovery_vault.resource_group_name

Review your Terraform file for Azure best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Manages registration of a storage account with Azure Backup. Storage accounts must be registered with an Azure Recovery Vault in order to backup file shares within the storage account. Registering a storage account with a vault creates what is known as a protection container within Azure Recovery Services. Once the container is created, Azure file shares within the storage account can be backed up using the azurerm_backup_protected_file_share resource. -> NOTE: Azure Backup for Azure File Shares is currently in public preview. During the preview, the service is subject to additional limitations and unsupported backup scenarios. Read More

Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers (Azure Resource Manager)

The vaults/backupFabrics/protectionContainers in Microsoft.RecoveryServices can be configured in Azure Resource Manager with the resource name Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.

Frequently asked questions

What is Azure Recovery Services Container Storage Account?

Azure Recovery Services Container Storage Account is a resource for Recovery Services of Microsoft Azure. Settings can be wrote in Terraform.

Where can I find the example code for the Azure Recovery Services Container Storage Account?

For Terraform, the owensengoku/terraform-multi-cloud, anmoltoppo/Terraform and davesee/terraform-caf-rover-breakout source code examples are useful. See the Terraform Example section for further details.