Capture VM and Create VM from managed image

Azure , , , , 2 Comments

Hi!

In this post I will show you how to Capture a VM and Create a new VM from that Image with Managed Disk(s).

Steps:

  1. Sysprep VM
  2. Capture VM
  3. Create VM from image

Step 1:

Install all your applications etc. and Sysprep your VM. Run SysPrep with ‘Generalize’.
When SysPrep is done, check if your VM is Shutdown (Deallocted)!

Step 2:

In the Azure Portal, on the VM’s Details pane click ‘Capture’:

Enter the details. Give a name to your new Managed Image and use an exsisting Resource Group or just create one. You could also choose to delete this VM after the image is created (the MD will not be deleted!)
Note: The Resource Group is just an ‘Resource group’ which holds your Managed Images. I prefer to group them into a separate Resource group.

Step 3:

In the Azure portal, go to the resource group in which you have create the image, and select the disk. Select ‘Create VM’

Just enter all the information as you normally would do when creating a fresh new VM:

Note: I think there might be a little bug into this wizard as it will ask you for a Storage Account…? Managed disks don’t use storage accounts.
I just finished the wizard and left the storage account ‘as is’, the VM was correctly created but the storage account wasn’t used or created….?

 

Step 2 (Powershell)

Step 3 (Powershell)

Gr,

Pieterbas


Resources:

Capture a managed image of a generalized VM in Azure
Create a VM from a generalized managed VM image

 

2 thoughts on “Capture VM and Create VM from managed image

  • Tom

    When creating an Azure VM from an generalized azure image the ability to select that I would like to the use Azure Hybrid Benefit is missing. Can I modify my existing Azure images to include that flag? -LicenseType “Windows_Server”

  • Pieterbas Nagengast Post author

    Tom,

    Yes, check:

    “There are few ways to use Windows virtual machines with the Azure Hybrid Benefit:
    – You can deploy VMs from one of the provided Windows Server images on the Azure Marketplace
    – You can upload a custom VM and deploy using a Resource Manager template or Azure PowerShell
    – You can toggle and convert existing VM between running with Azure Hybrid Benefit or pay on-demand cost for Windows Server
    – You can also deploy a new virtual machine scale set with Azure Hybrid Benefit for Windows Server”

    Link: https://docs.microsoft.com/sl-si/azure/virtual-machines/windows/hybrid-use-benefit-licensing?view=azurermps-4.2.0#deploy-a-vm-via-resource-manager

    gr,
    Pieterbas

    ps. sorry for the late response… had some issues with the comments on this WordPress site… 😉

Leave a Reply

Your email address will not be published.

*