Linux – Duplicate a Linux virtual machine on Azure

azurelinuxvirtual-machines

I am trying to duplicate a Linux virtual machine I have in Azure (Not Classic VM).

I went through the following documentation:
https://docs.microsoft.com/en-us/azure/virtual-machines/linux/capture-image

However, I am still not sure about the Deprovision part.
I know I will not be able to access to the old VM while deploying the new image of the current VM. The question is, will I be able to access to the old VM after the deployment and will the files and data will be deleted on the old VM? if so how can I create a new image without deleting the files and data on old VM?

Best Answer

will I be able to access to the old VM after the deployment and will the files and data will be deleted on the old VM?

After the deployment completed, we can't login to this VM. we can use this image to create new VMs. The files and data will not be delete. After we create new VM, we can find files and data in it.

if so how can I create a new image without deleting the files and data on old VM?

If you want to create a new image and want to keep this VM, we should backup this VM's VHD (copy and save this VHD with a different name). After we create the new image, we use the copy VHD to create a VM, in this way, we can login the original VM.

About create Azure VM with existing VHD and existing Vnet, we can use this template to create it.