Using portal:
- In the left menu, select Virtual Machines.
- Select the virtual machine that has the data disk you want to detach and click Stop to deallocate the VM.
- In the virtual machine pane, select Disks.
- At the top of the Disks pane, select Edit.
- In the Disks pane, to the far right of the data disk that you would like to detach, click the detach button.
- After the disk has been removed, click Save on the top of the pane.
- 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