How to detach a data disk from a Windows VM

Using portal:

  1. In the left menu, select Virtual Machines.
  2. Select the virtual machine that has the data disk you want to detach and click Stop to deallocate the VM.
  3. In the virtual machine pane, select Disks.
  4. At the top of the Disks pane, select Edit.
  5. In the Disks pane, to the far right of the data disk that you would like to detach, click the Detach button image detach button.
  6. After the disk has been removed, click Save on the top of the pane.
  7. In the virtual machine pane, click Overview and then click the Start button at the top of the pane to restart the VM.

Using PowerShell:

$VirtualMachine = Get-AzureRmVM -ResourceGroupName “myResourceGroup” -Name “myVM” Remove-AzureRmVMDataDisk -VM $VirtualMachine -Name “myDisk” Update-AzureRmVM -ResourceGroupName “myResourceGroup” -VM $VirtualMachine

Leave a comment