我正在使用Terraform为文件共享创建Azure Recovery Services Vault。但它一直报告错误:
Error: registering backup protection container StorageContainer;storage;fer-bpcm-d-rsg-commonsa;xxxbpcmpcgl (Vault fer-bpcm-p-euwe-rvt-golden): backup.ProtectionContainersClient#Register: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="BMSUserErrorContainerIsAssociatedWithAnotherVault" Message="Container is associated with another vault. Please select the right vault to proceed with the container operation."
with module.recovery_services_vault.azurerm_backup_container_storage_account.protection_container["fer-bpcm-p-euwe-rvt-golden~xxxbpcmpcgl~data"],
on ../modules/LandingZone/BPCM/recovery_services_vault/main.tf line 75, in resource "azurerm_backup_container_storage_account" "protection_container":
75: resource "azurerm_backup_container_storage_account" "protection_container" {
字符串
Terraform片段如下:
resource "azurerm_recovery_services_vault" "fs_rsv_vaults" {
for_each = { for fs_rsv_vault in var.fileshare_recovery_vaults : fs_rsv_vault.name => fs_rsv_vault }
name = each.value.name
resource_group_name = each.value.resource_group_name
location = each.value.location
# sku, immutability, storage_mode_type, soft_delete_enabled
# public_network_access_enabled, cross_region_restore_enabled, tags,identity
}
resource "azurerm_backup_policy_file_share" "rsv_vault_policy" {
for_each = { for policy in local.rsv_vault_policy_list : "${policy.vault_name}~${policy.policy_name}" => policy }
name = each.value.policy_name
resource_group_name = azurerm_recovery_services_vault.fs_rsv_vaults[each.value.vault_name].resource_group_name
recovery_vault_name = azurerm_recovery_services_vault.fs_rsv_vaults[each.value.vault_name].name
# timezone, backup, retention_daily
}
resource "azurerm_backup_container_storage_account" "protection_container" {
for_each = { for fileshare in local.fileshare_list : "${fileshare.recovery_vault_name}~${fileshare.storage_account_name}~${fileshare.source_file_share_name}" => fileshare }
resource_group_name = azurerm_recovery_services_vault.fs_rsv_vaults[each.value.recovery_vault_name].resource_group_name
recovery_vault_name = each.value.recovery_vault_name
storage_account_id = data.azurerm_storage_account.storage_accounts[each.value.storage_account_name].id
}
型
我检查了documetation但是如何将唯一的保护容器azurerm_backup_container_storage_account
关联到每个存储帐户,因为保护容器没有name
参数?我做错了什么?
我正在传递存储帐户列表,如下所示:
fileshare_recovery_vaults = [
{
name = "myvault"
resource_group_name = "rsg-backup"
...
backup_policies = [
{
policy_name = "policy-filesh"
timezone = "UTC"
backup_frequency = "Daily"
backup_time = "00:00"
retention_daily_count = 30
}
]
fileshares = [
{
storage_account_name = "xxxbpcmpcga"
source_file_share_name = "data"
resource_group_name = "rsg-commonsa"
policy_name = "policy-filesh"
},
{
storage_account_name = "xxxbpcmpcgl"
source_file_share_name = "data"
resource_group_name = "rsg-commonsa"
policy_name = "policy-filesh"
}
]
..
}]
型
1条答案
按热度按时间smdncfj31#
我尝试为Azure存储帐户和文件共享注册备份保护容器,我能够成功配置要求。
您遇到的错误
BMSUserErrorContainerIsAssociatedWithAnotherVault
表示您尝试向Azure Recovery Services保管库注册的存储容器已与其他保管库关联。这是重用以前与其他保管库关联的存储帐户或容器时的常见问题。当我尝试将新的恢复服务保险库与已经与另一个保险库关联的存储容器链接时,我遇到了您提到的相同问题。
的数据
在Azure中,存储帐户容器一次只能与一个Recovery Services保管库关联。如果您尝试将其与新保管库关联,而没有先将其与现有保管库解除关联,则会遇到此错误
我的Terraform配置:
字符串
variable.tf:
型
terraform.tfvars:
型
输出:
的
的
的