Review Azure VM migration to managed disks

Migrate retired unmanaged disks to managed disks and verify recovery procedures.

Description

Azure retired unmanaged disks on March 31, 2026. VMs using them cannot start. Azure stops and deallocates running or allocated VMs that still use these disks.

Potential impact

Changing Terraform disk properties before migrating the existing VHD can replace the disk or cause data loss.

Remediation

  1. Verify that you can restore your backup. Plan downtime and Terraform state changes.
  2. Follow Azure’s managed-disk migration procedure for the VM’s operating system.
  3. Verify that the VM boots and the application works. Check disk performance, backups, and permissions.

Examples

These historical azurerm_virtual_machine excerpts compare vhd_uri with managed_disk_type. They omit OS image and authentication settings.

Before

hcl
resource "azurerm_virtual_machine" "example" {
  name                  = "${var.prefix}-vm"
  location              = azurerm_resource_group.example.location
  resource_group_name   = azurerm_resource_group.example.name
  network_interface_ids = [azurerm_network_interface.main.id]
  vm_size               = "Standard_DS1_v2"

  storage_os_disk {
    name          = "myosdisk1"
    create_option = "FromImage"
    vhd_uri       = "https://<storageaccount>.blob.core.windows.net/<container>/<diskname>.vhd"
  }
}

After

hcl
resource "azurerm_virtual_machine" "example" {
  name                  = "${var.prefix}-vm"
  location              = azurerm_resource_group.example.location
  resource_group_name   = azurerm_resource_group.example.name
  network_interface_ids = [azurerm_network_interface.main.id]
  vm_size               = "Standard_DS1_v2"

  storage_os_disk {
    name              = "myosdisk1"
    caching           = "ReadWrite"
    create_option     = "FromImage"
    managed_disk_type = "Standard_LRS"
  }
}

References