Have you ever thought of capturing the image of your virtual machine so that you can either share or reuse it? Then, Azure compute gallery is a resource that you should not overlook. It should not be a surprise to know that a copy of a whole VM (including any associated data drives) or simply the OS disk, depending on how it was made, is what an image is. Kindly refer to these related guides: How to Configure Windows Sandbox and how to write a Shell Script that Counts Lines and Words in a File.
The Virtual Hard Drives in the image are copied when you build a VM from it, and the new VM’s disks are made from those copies. The most interesting thing about an image is that you can keep it in storage and use it for countless VM creations if need be. Other articles can be found here: How to install Groovy on Linux and Windows and How to install Googler on a Linux System and How to Install PlayonLinux on a Linux System.
Images stored in Azure Compute Gallery
1: Generalized images: Generalizing is a procedure that purges the VM of the machine- and user-specific and generalizing an image in Azure compute gallery is as easy as a push of a button because it is a requirement.
2: Specialized VMs have not undergone a procedure to eliminate machine-particular data and accounts. Additionally, osProfiles are not attached to virtual machines built from specialized images. Therefore, in addition to their advantages, specialized images will also have certain drawbacks.
Benefits of using Specialized Images
VMs and scale sets created from specialized images can be up and running more quickly. Because they are created from a source that has already been through the first boot, VMs created from these images boot faster.
Any VM built using the customized image that is created from that VM may be logged into using the same accounts that can be used to log into the VM thereby making administration of that VM easier
Can be logged into without Admin username and password
Shareability of images stored in compute galleries
Specific people, groups, or service principals: You may share resources on a very specific level with certain individuals, groups, or service principals using role-based access control (RBAC).
Subscriptions or Tenants Sharing to everyone in a tenancy or subscription is possible with a straight shared gallery.
Anyone: All Azure users may access your whole gallery using the community gallery.
Demonstration on how to use Azure Compute Gallery
- Create a Compute Gallery
- Create a Resource Group & a Virtual Machine either with cli or from the portal
- Take a snapshot of the Virtual Machine and Save the snapshot in the Compute Gallery created
- create an image from the image saved in the gallery
1. Azure compute gallery, with these steps
Log in to the Azure portal (https://portal.azure.com/) using your Azure account credentials.
In the search resource, services and docs field, type Azure Compute Gallery.
2. Select the best option from the search result and hit enter, it would usually be grayed out
3. create on either of the create buttons
4. Enter your project details this includes your subscription and your resource group
5. Enter your instance details this include Name, location and description of the gallery
7. Review to start Validation
9. Go to Resource to start using Gallery
10. View Gallery
2. Create a Resouce group & a Virtual Machine with Cli
Create a resource group first, then proceed to create a VM with Azure Cli using the command below:
az group create --name techdrg --location EastUS az vm create \ --resource-group techdrg \ --name AMG \ --image UbuntuLTS \ --generate-ssh-keys
The Resource Group should be created first then the virtual machine
The virtual machine comes next
Here are the created resource in the portal
3. Save a snapshot of the Virtual Machine in the Compute Gallery
- Click on Capture
2. Focus on the Gallery detail, select the gallery you created earlier & the operating system state
3. Create a target VM definition
4. Create version detail for your VM
5. Review & Create
6. Wait for the deployment to be complete
7. Go to Resource to access newly created image
8. Image creation succeeded
4. Create an image from the image saved in the gallery
So you see we have an image in the galllery that can be used to create other images
- Click on create VM
2. from the basics tab, fill in project details and for instance details choose the image from the gallery
2. Admin Details. We can clearly see that the username and password have been grayed out because we choose to have a specialized image during the creation of the compute gallery image
3. Select your inbound port rules, then review and Create
The image has been created, it took a very short time to create
Preconfigured virtual machines and apps in the Azure Compute Gallery are available for quick deployment on Azure. Instead of manually installing and configuring the program, users may rapidly spin up a virtual machine with their preferred software by using the gallery. This article have shown steps that can be taken in order to create a compute gallery and also how to create a generalized image and finally create a vm from a generalized image.