I need a solution to copy image along with the data disk or attach a data disk to the existing managed image.
I tried copying the image using az copy but it doesn’t copy attached data disk.
I need a solution to copy image along with the data disk or attach a data disk to the existing managed image.
I tried copying the image using az copy but it doesn’t copy attached data disk.
2
Answers
I created a VM using my image and then followed the above steps to copy the data disk and attach it to the VM. Then I took the snapshot of the VM in order to create the image which fulfilled my requirement.
To copy the disk across region, make use of below PowerShell script
Output:
To confirm in portal disk copy to another region successfully like below:
References:
Upload a VHD to Azure or copy a disk across regions – Azure PowerShell – Azure Virtual Machines | Microsoft Learn
Attach a data disk to a Windows VM in Azure by using PowerShell – Azure Virtual Machines | Microsoft Learn