DEV Community

Cover image for HOW TO CAPTURE A VM IMAGE AND USE IT TO CREATE A NEW VM USING AZURE PORTAL
Bernard Chika Uwaezuoke
Bernard Chika Uwaezuoke

Posted on

HOW TO CAPTURE A VM IMAGE AND USE IT TO CREATE A NEW VM USING AZURE PORTAL

This article is a straightforward guide on how to successfully capture a customized VM image, store in in the Compute gallery. The use the image to replicate similar VMs as the need arise in various regions

Prerequisites

  1. Azure account
  2. Azure compute gallery
  3. A running virtual machine

HERE ARE THE STEPS

1. Capture and store an image

  • Go to the search bar at the top of the Azure portal and search for Virtual machines. Click on the virtual machine and select the virtual machine you want to capture the image and click on it. This opens the overview page of the selected machine.

Image description

  • Click on the Capture button at the top of the overview page. This takes you to the Create an image page.

Image description

  • Under Basic you have Project details which has Subscription and Resource group already provided from the configuration of the VM. You can change the resource group, if you wish to.

  • Under Instance details, the Region is provided by default. Select radio button Yes for Share image to Azure compute gallery.

Image description

You may check the box Automatically delete this virtual machine after creating the image if you no longer have any use for the Virtual Machine thereafter.

  • Under Gallery details, select your preferred gallery to save the image in Target Azure compute gallery or click on Create new if you have no gallery. Then on Operating system state, choose the Generalized option if you do not want to use the VM afterwards or the Specialized if reverse is the case. Click on Create new for Target VM image definition, this will open a tab, where you can provide the details.

Image description

Go ahead and provide the required details. The name of the image, most configurations here are already provided by default. Click OK button and continue with the Create an image page.

Image description

  • Enter the Version number, following the format provided eg: 0.0.1.

  • Under Replication, enter the number of replicas you want to create, the Target regions, *Target region replica count * is the number of replicas to be created in that region, then select the storage type. All these choices have cost implications.

  • Then click on Review + create
    When you see the notification Validation passed, Click on the Create button to commence the process.

Image description

When the deployment is completed, this page will display.

Image description

  • Click on Go to resource This will take you to the Overview page of the image you just captured.

Image description

2. Create a VM from an image

  • Go to the Overview page of the image in the compute gallery by clicking on the image.

  • Then click on the Create VM button

Image description

This will take you to the Create a virtual machine page.

  • Under Project detail, you select Subscription and Resource group

  • Under Instance details, you provide the Virtual machine name, Region, and change the security configuration if you wish or leave the one that came with the image. The Image is automatically provided.

Image description

Going further down the page, you select the radio button Allow selected ports for Public inbound ports. You can also select your desired ports for Select inbound ports.

  • Under Licensing, select the License type.

Image description

  • Click the Review + create button.
    This will kickstart the validation process. The validation ends with the notification Validation passed.

  • Then click on the Create button.

Image description

Deployment in progress

Image description

Deployment is complete.

Image description

  • Click on Go to resource This will take you to the Overview page of the new VM you just created from the image in your gallery.

Image description

  • Go to the search bar at the top of the Azure portal and search for and select Virtual Machines. Then view both machines, the original and the second one you created from the image captured.

Image description

You will notice that the original VM has been deallocated (stopped). You can go ahead and restart it to have both machines running.

Hope this article was able to guide you accomplish your task successfully.

Top comments (0)