Thursday, 22 December 2022

VM images (classic)

 VM Image :

Once you have a virtual machine set up and configured as you want, you can capture the instance as a VM Image.  During the capture process, all relevant properties of the virtual machine and disks are stored and copies of the backing VHD page blob(s) are made.  The copy of each VHD is stored in the same storage account and container as the original VHD being copied.  If you are interested in finding the copied VHDs in Azure Storage, search for page blobs with the following naming convention: for the OS VHD, we use <VM Image Name>-os-YYYY-MM-DD<-ZZ> and for the copied data VHDs, we use <VM Image Name>-datadisk-<Lun>-YYYY-MM-DD(-ZZ).  The date is when the VM Image was captured and the -ZZ is a number, added only if there is a collision, to make the name unique.  During capture, no in-memory state is saved and as such, this feature is not meant to replace the current backup and restore options for Microsoft Azure.  If you are interested in more information about backup and restore. If the OS has been generalized/deprovisioned, the virtual machine must be shut down in order to capture it as a VM Image.  Once the VM has been captured as a VM Image, the virtual machine will automatically be deleted.  If the OS is specialized, the virtual machine can be captured while it is running or shut down.  The captured virtual machine remains untouched.  If an application consistent or cross-disk capture is needed, we recommend the virtual machine is shut down prior to capturing the VM Image.

 Use a VM Image :

You can use a VM Image when creating a virtual machine as part of a new or existing deployment.  To deploy a new VM, make sure the virtual machine and VM Image location are the same and then simply provide the name of the VM Image to use.  If the VM Image is generalized, provisioning information and network configuration should also be provided, like with an OS Image today.  Once the virtual machine has been deployed, it behaves the same as any other VM created from OS Images or OS disks.  The role can be updated, additional disks may be attached, or the existing disks detached. If the VM Image is specialized, no provisioning information is needed, like with an OS disk today.  When a virtual machine is deployed from a VM Image, a copy of the VHDs are made for the new VM; in other words, the existing VHDs are not attached directly.  After deploying a virtual machine from a specialized VM Image, the VM will spin up and look to be in a running state very quickly after deployment, since provisioning was not required.  However, the virtual machine may still be booting up, requiring a few additional minutes for remote desktop/SSH to be ready. Once again, after the virtual machine is deployed and running, it behaves the same as any other VM created from OS Images or OS disks.  One small caveat to this statement is when you deploy a new virtual machine from a specialized Windows VM Image that was captured from a running VM. When using such a VM Image, you may see a dialog pop up stating the VM was not properly shutdown when you first remote desktop into the newly deployed VM.

 

Get-AzureVMImage

To list all VM Images in the image repository, use the Get-AzureVMImage cmdlet:
Get-AzureVMImage

No comments:

Post a Comment