Azure disk

Vamsi krishna Machavarapu 1 Reputation point

Does the data will be available once detaching the disk from the vm? Can I use same disk later in sometime with existing data?

Azure Disk Storage
Azure Disk Storage
A high-performance, durable block storage designed to be used with Azure Virtual Machines and Azure VMware Solution.
583 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Andriy Bilous 10,996 Reputation points MVP

    Hello @Vamsi krishna Machavarapu

    If you detach a disk it is not automatically deleted and all data will be preserved.
    You can attach an existing managed disk with your data to a new VM as a data disk.
    Using Powershell:

    $rgName = "myResourceGroup"  
    $vmName = "myVM"  
    $dataDiskName = "myDisk"  
    $disk = Get-AzDisk -ResourceGroupName $rgName -DiskName $dataDiskName  
    $vm = Get-AzVM -Name $vmName -ResourceGroupName $rgName  
    $vm = Add-AzVMDataDisk -CreateOption Attach -Lun 0 -VM $vm -ManagedDiskId $disk.Id  
    Update-AzVM -VM $vm -ResourceGroupName $rgName  

    Then Add data disk at OS level

    Using Portal:

    1. Go to the Azure portal to find the VM. Search for and select Virtual machines.
    2. Choose the VM from the list.
    3. In the Virtual machines page, under Settings, choose Disks.
    4. On the Disks pane, under Data disks, select Attach existing disks.
    5. Click the drop-down menu for Disk name and select a disk from the list of available managed disks.
    6. Click Save to attach the existing managed disk and update the VM configuration
    7. Add data disk at OS level
    0 comments No comments