{"id":3348,"date":"2023-03-09T16:40:52","date_gmt":"2023-03-09T22:40:52","guid":{"rendered":"https:\/\/microsoftgeek.com\/?p=3348"},"modified":"2023-03-09T16:40:52","modified_gmt":"2023-03-09T22:40:52","slug":"cloning-azure-vms","status":"publish","type":"post","link":"https:\/\/microsoftgeek.com\/?p=3348","title":{"rendered":"Cloning Azure VMs"},"content":{"rendered":"\n<p>Cloning an Azure virtual machine is something I thought it was directly integrated (as in, one click\/command and that&#8217;s it, but no, it involves several steps. However, it is not complicated, and in this post I will explain how to do it!<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/practicaldev\/image\/fetch\/s--6_qm6tjo--\/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880\/https:\/\/dev-to-uploads.s3.amazonaws.com\/uploads\/articles\/9uw1tea0n44wptkrlpfo.png\" alt=\"An Azure Virtual Machine\"\/><\/figure>\n\n\n\n<p><strong>Step 1.<\/strong>&nbsp;Go to&nbsp;<strong>Azure portal<\/strong>, navigate to the&nbsp;<strong>virtual machine<\/strong>&nbsp;you want to clone. In the&nbsp;<strong>Disks<\/strong>&nbsp;section, click on its&nbsp;<strong>operating system disk<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/practicaldev\/image\/fetch\/s--SC4Ly5j3--\/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880\/https:\/\/dev-to-uploads.s3.amazonaws.com\/uploads\/articles\/s08gul03vnaa8nn0gsi3.png\" alt=\"Selecting the Azure VM OS Disk\"\/><\/figure>\n\n\n\n<p><strong>Step 2.<\/strong>&nbsp;Create a disk snapshot by clicking on the&nbsp;<strong>Create snapshot<\/strong>&nbsp;button.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/practicaldev\/image\/fetch\/s--kDmcJB4u--\/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880\/https:\/\/dev-to-uploads.s3.amazonaws.com\/uploads\/articles\/2ikwngazp1kk6cpls2li.png\" alt=\"Creating a disk snapshot\"\/><\/figure>\n\n\n\n<p><strong>Step 3.<\/strong>&nbsp;Fill out the form (only the&nbsp;<strong>name<\/strong>&nbsp;is required). You can change other details such as the subscription, resource group, snapshot type if you want. Click on&nbsp;<strong>Review + Create<\/strong>, if there are no errors the resource will be successfully created.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/practicaldev\/image\/fetch\/s--tmaWFtrh--\/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880\/https:\/\/dev-to-uploads.s3.amazonaws.com\/uploads\/articles\/5qvwi08gpuh1u4022lp7.png\" alt=\"Preparing the snapshot\"\/><\/figure>\n\n\n\n<p><em>(Repeat the above steps if the virtual machine contains data disks and you want to include them later in the clone VM as well)<\/em><\/p>\n\n\n\n<p><strong>Step 4.<\/strong>&nbsp;Now create a&nbsp;<strong>Managed Disk<\/strong>&nbsp;resource. Fill in the required information, and in the&nbsp;<strong>Source type<\/strong>&nbsp;field choose&nbsp;<strong>snapshot<\/strong>&nbsp;and select the corresponding&nbsp;<strong>subscription<\/strong>&nbsp;and&nbsp;<strong>snapshot<\/strong>&nbsp;that you just created. Click on&nbsp;<strong>Review + Create<\/strong>&nbsp;and if everything goes as expected, the you will get a new managed disk.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/practicaldev\/image\/fetch\/s---6ViPcH0--\/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880\/https:\/\/dev-to-uploads.s3.amazonaws.com\/uploads\/articles\/k6p916h0udfli4o4aur2.png\" alt=\"Creating a managed disk\"\/><\/figure>\n\n\n\n<p><em>(Repeat step 4 for data disks you have previously cloned)<\/em><\/p>\n\n\n\n<p><strong>Step 5.<\/strong>&nbsp;Access to the details of this brand new resource and click on the&nbsp;<strong>Create VM<\/strong>&nbsp;button.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/practicaldev\/image\/fetch\/s--4tx5ygZK--\/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880\/https:\/\/dev-to-uploads.s3.amazonaws.com\/uploads\/articles\/zsczrr7rmhcev7fk73k0.png\" alt=\"Managed disk options\"\/><\/figure>\n\n\n\n<p><strong>Step 6.<\/strong>&nbsp;Now fill in the requested data in the&nbsp;<strong>Basics<\/strong>&nbsp;section. Click on the&nbsp;<strong>Disks<\/strong>&nbsp;tab in order to add managed data disks in case you generated them too. Otherwise, simply proceed to click on Create + Review.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/practicaldev\/image\/fetch\/s--eeBpitUR--\/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880\/https:\/\/dev-to-uploads.s3.amazonaws.com\/uploads\/articles\/e00rd1mecfp4vqxse2ca.png\" alt=\"Creating a virtual machine\"\/><\/figure>\n\n\n\n<p><strong>And that&#8217;s it!<\/strong>&nbsp;Once the resource is created, start the new virtual machine if it&#8217;s stopped, connect, and there you have it! An exact copy of the original resource (and independent of course, as it&#8217;s a new virtual machine with its own disk).<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/practicaldev\/image\/fetch\/s--SqOwdrBZ--\/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880\/https:\/\/dev-to-uploads.s3.amazonaws.com\/uploads\/articles\/r13ilqrd0ev0v2phwo10.png\" alt=\"The new virtual machine (clone)\"\/><\/figure>\n\n\n\n<p>In my case, I first created a virtual machine and installed software such as Visual Studio 2022, Visual Studio Code, Anaconda, among others. Then, instead of repeating the same process (create new VMs, install manually the software in each of the new ones), I just followed the above 6-step process and&nbsp;<em>voil\u00e1<\/em>, I got exact copies (clones) of the virtual machines.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Cloning an Azure virtual machine is something I thought it was directly integrated (as in, one click\/command and that&#8217;s it, but no, it involves several steps. However, it is not complicated, and in this post I will explain how to do it! Step 1.&nbsp;Go to&nbsp;Azure portal, navigate to the&nbsp;virtual machine&nbsp;you want to clone. In the&nbsp;Disks&nbsp;section, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[69,35],"tags":[],"class_list":["post-3348","post","type-post","status-publish","format-standard","hentry","category-azure","category-cloud-computing"],"_links":{"self":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts\/3348","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3348"}],"version-history":[{"count":1,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts\/3348\/revisions"}],"predecessor-version":[{"id":3349,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts\/3348\/revisions\/3349"}],"wp:attachment":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3348"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3348"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3348"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}