When moving or duplicating Azure Virtual Machines (VMs), you may encounter an issue where the VM’s disk is offline due to a signature collision. This commonly happens when:

  • Cloning disk images (using dd, azcopy, or exporting VHDs).
  • Creating a new VM from a disk snapshot.
  • Restoring a VM using a copied OS or data disk.

Since Windows assigns a unique identifier (disk signature) to each disk, if two disks have identical signatures, Windows prevents conflicts by marking one disk as Offline. The error message in Disk Management typically states:

The disk is offline because it has a signature collision with another disk that is online.
Fixing Disk Signature Collision in Azure VM After Cloning or Using Snapshots with Windows 1

This guide explains how to detect and fix the issue using Disk Management, Diskpart, and PowerShell.


Why This Happens in Azure?

When you create an Azure VM using a snapshot or exported VHD, the original disk signature is preserved. When you attach this disk to a new VM, Windows detects duplicate disk signatures, leading to:

  • One disk being taken offline automatically.
  • Boot errors if the disk is critical (for example, if it’s the OS disk).
  • Issues with mounting data disks correctly.

How to Detect the Issue

If you suspect a disk signature collision:

  1. Open Disk Management

    • Press Win + R, type diskmgmt.msc, hit Enter.
    • Look for a disk marked as Offline.
    • Right-click the disk, select Properties, check for a signature conflict.
  2. Check Disk Signatures with Diskpart

    • Open Command Prompt as Administrator
    • Run the following commands:
      diskpart
      list disk
      
    • Identify the offline disk (it won’t have an asterisk under “Gpt” or “Dyn”).
    • Select the disk and check its unqiue ID:
      select disk X  # Replace X with the disk number
      uniqueid disk
      
    • If the unique ID is the same as another disk, you’ve found the issue.
  3. Check Disk Signatures with PowerShell

    • Run:
      Get-Disk | Select-Object Number, UniqueId, OperationalStatus
      
    • Look for duplicate UniqueID values.

Fix: Changing the Disk Signature

To resolve the issue, you need to assign a new unique identifier to the offline disk.

Warning: Always take a backup or Disk snapshot of the VM disks before attempting this. Just in case you need to restore from backup.

Method 1: Using Diskpart (Recommended)

  1. Open Command Prompt as Administrator and enter diskpart.

  2. Run the following commands:

    list disk
    select disk X # Replace X with the offline disk number
    uniqueid disk # view the current ID
    
  3. Assign a new hexadecimal ID to the disk:

    uniqueid disk ID=ABCDEF12 # Change ABCDEF12 to any unique value
    
  4. Bring the disk online:

    online disk
    

5 Close Diskpart and check Disk Management again.


Method 2: Using PowerShell

Alternatively, you can use PowerShell:

$disk = Get-Disk | Where-Object {$_.OperationalStatus -eq "Offline"}
Set-Disk -Number $disk.Number -UniqueId "NEWUNIQUEID"
Set-Disk -Number $disk.Number -IsOffline $false

Replace NEWUNIQUEID with a unique hexadecimal identifier.


Method 3: Recreating the VM in Azure

If the above methods don’t work or the disk is the OS disk, you may need to re-deploy the VM with a fresh copy:

  1. Detach the conflicting disk from the VM in Azure Portal.

  2. Create a new Managed Disk from the VHD:

    $resourceGroup = "YourResourceGroup"
    $diskName = "NewDisk"
    $location = "eastus"
    $vhdUri = "https://storageaccount.blob.core.windows.net/vhds/disk.vhd"
    
    # Create a disk configuration object
    $diskConfig = New-AzDiskConfig -Location $location -CreateOption Import -SourceUri $vhdUri
    
    # Create the managed disk
    New-AzDisk -ResourceGroupName $resourceGroup -DiskName $diskName -Disk $diskConfig
    
  3. Attach the new disk to the VM and reboot.


Preventing This Issue in the Future

  1. Change the Disk Signature Before Attaching to Another VM Before using a disk snapshot or clone, modify the disk signature:

    diskpart
    list disk
    select disk X
    uniqueid disk ID=NEWID123
    
  2. Use Azure Image-Based Cloning Instead of VMD Copying Instead of manually cloning a disk, use Azure Shared Image Gallery:

    $resourceGroup = "MyResourceGroup"
    $imageName = "MyNewImage"
    $vmId = "/subscriptions/.../resourceGroups/.../providers/Microsoft.Compute/virtualMachines/MyVM"
    $location = "eastus"  # Set the appropriate Azure region
    
    # Create an image configuration from an existing VM
    $imageConfig = New-AzImageConfig -Location $location
    $imageConfig = Set-AzImageOsDisk -Image $imageConfig -OsType Windows -OsState Generalized -SourceVirtualMachineId $vmId
    
    # Create the image
    New-AzImage -ResourceGroupName $resourceGroup -ImageName $imageName -Image $imageConfig
    
  3. Detach the Disk before creating a Snapshot If taking a snapshot, first detach the disk from the VM, then create a snapshot.


Conclusion

Disk signature collisions happen in Azure VMs when cloning or snapshotting disks without modifying their Unique IDs. The quickest fix is using Diskpart or PowerShell to change the disk signature and bring it online.

By following the preventive measures, you can avoid issues when migrating VMs or restoring backups.

Chris Pietschmann is a Microsoft MVP, HashiCorp Ambassador, and Microsoft Certified Trainer (MCT) with 20+ years of experience designing and building Cloud & Enterprise systems. He has worked with companies of all sizes from startups to large enterprises. He has a passion for technology and sharing what he learns with others to help enable them to learn faster and be more productive.
Microsoft MVP HashiCorp Ambassador

Discover more from Build5Nines

Subscribe now to keep reading and get access to the full archive.

Continue reading