How to clone a VM in AZURE easily to create a new similar VM

I am explaining the easiest method when you wanted to clone an existing VM and create a copy from it through Azure Portal

Note: The following steps are applicable to an existing VM with only OS disk attached. Also the steps are performed for a CENTOS 7.8 Linux VM

STEP1: Create a snapshot of the disk. Go to the VM and click Disk

STEP2: Select the Disk

STEP3: Create Snapshot. You may go with default values. Just provide a name for the snapshot

STEP4: Create a Disk from the snapshot. Select the snapshot just created and click Create Disk. Create with default values and preferred name

STEP5:Create VM. Select the Disk created and start Creating the VM. In the Create VM page you will see the Image Name (Disk Name) we just have created

Note: You may need to select/Unselect some of the preferences like Monitoring, Auto Shutdown. Also, add tags if needed. Rest all settings can be default values

STEP6: Login to the VM

(Follow the steps only if you need to login the cloned VM using username and password)

I have setup the existing VM to Login with root user and password (without using any ssh authentication). But the cloned VM can’t go with root user and password from the existing VM. So, login the cloned VM using the ssh key and et the following value in /etc/ssh/sshd_config

PasswordAuthentication yes

Hit a sshd restart (service sshd restart). Also, you may set a new hostname (/etc/hostname)

Now your cloned VM is ready to login using username and password too

Tags:

4 Responses

Leave a Reply to IGwe Stanley Cancel reply

Your email address will not be published. Required fields are marked *

Recent Comments