I'm trying to replicate Azure Windows VM, the OS disk is replicating properly but unable to replicate the data disk using Terraform script, getting the same error after trying multiple times.
All the values are correct facing an issue with data disk replication only:
│ Error: updating replicated vm vm-replication (vault example-recovery-vault): polling after Update: polling failed: the Azure API returned the following error:
│
│ Status: “150153”
│ Code: “”
│ Message: “Could not update the properties of the virtual machine ‘example-machine’ because of following invalid disk Ids: ‘/subscriptions/******************************
My code is the following:
managed_disk {
disk_id = “/subscriptions/******************************"
staging_storage_account_id = azurerm_storage_account.primary.id
target_resource_group_id = azurerm_resource_group.secondary.id
target_disk_type = “Premium_LRS”
target_replica_disk_type = “Premium_LRS”
}
Here is the updated Terraform code to replicate the both OS and Data disk of the VM.
The terraform code created a VM with a data disk and attached it to the VM.
After running the terraform code, both OS and data disk has been replicated successfully.
Terraform apply:
Reference: azurerm_site_recovery_replicated_vm