I need to install a few software on a virtual machine in order to test my application. It would take 2-3hours to set it up. Can I just replicate the virtual machine 3 times afte
Yes, you can use the capture capability to create a base image that you can then use to deploy other machines from. Take a look at these instructions: http://azure.microsoft.com/en-us/documentation/articles/virtual-machines-capture-image-windows-server/.
This assumes you are referring to a Windows Server machine. Also, it assumes that a sysprep won't affect the software you have installed. If a sysprep will cause a problem them you also might be able to take a copy of the underlying VHD and spin up a different machine from the copy. Both methods are explained in this article here: http://community.adxstudio.com/blogs/shan/2012-06-28-cloning-windows-azure-virtual-machines/
Yes you can, here is how I did it. I did not have to use PowerShell and my original VM still worked after.
Result if you use sysprep
from documentation:
Once you have run sysprep on an VM it is considered generalized and it cannot be restarted. The process of generalizing a VM is not reversible. If you need to keep the original VM functioning, you should take a copy of the VM and generalize the copy.
https://docs.microsoft.com/en-us/azure/virtual-machines/windows/capture-image-resource?toc=%2Fazure%2Fvirtual-machines%2Fwindows%2Fclassic%2Ftoc.json
Steps:
Start by copying a disk. Create a snapshot, then create a disk from the snapshot. This allows you to keep the original VHD as a fall back.
Create a VM from a disk Once you have the managed disk VHD that you want to use, you can create the VM in the portal.
I choose to create a new virtual network since the servers themselves did not need any local connections.
https://docs.microsoft.com/en-us/azure/virtual-machines/windows/create-vm-specialized-portal#copy-a-disk