Managed Images on Azure Stack

This last week I had the chance to start working with managed images on Azure Stack. As of the recent update release of 1901, managed images is now available for everyone.

You may be asking yourself a few questions right about now. Like, what is a managed image? Why do I need a manage image? Why is Chicago Deep Dish so much better than the New York thin crust? Oh wait, that was in my head and probably not in yours.

I can answer some of these questions based off my limited experience with manage images both in Azure and Azure Stack.

What is a Managed Image?

A managed image is a resource that is created from a VM that generalized. These images are then stored as a managed disk or an unmanaged disk. More than likely we would be storing them as a managed disk resource.

Why Do I need to use Managed Image?

For my personal use I don’t see the need for a managed image. However, there are some good use cases that I will talk about. When working with various groups or clients I may run across the need to duplicate a VM and it’s contents fairly fast with very little configuration. For example, a lab environment that needs to be deployed over and over again without having to deploy the VM’s, run configuration scripts, download content, etc to each VM. Yes, with the proper automation most of that can be done but this case and many other situations we may not have that option. So we have a VM that may contain all the downloaded content, some of which could be fairly large. So taking the time for customization to download those files can be spared with a manage image. This use case would fall under the “having a generalized manage VM and would like to create multiple, similar managed VM’s”

Another use case for manage image would be used to migrate unmanaged VM’s to managed disk moving forward. You can read more about manage images and managed disk on the Microsoft Docs: https://docs.microsoft.com/en-us/azure/azure-stack/user/azure-stack-managed-disk-considerations#managed-images

How Do I start?

First I need a VM to generalize. I have a few choices here, upload a customized image, deploy a new VM and customize it within the portal, or create a managed image from a snapshot of an existing VM. For this blog I am going to talk about grabbing a managed image from an existing VM already deployed.

If I had planned to upload a custom image I would have followed the instructions from a previous blog: https://kristopherjturner.com/2018/12/13/windows-server-2019-and-azure-stack-my-curiosity-got-to-me/ or I can follow the Microsoft Documentation here: https://docs.microsoft.com/en-us/azure/azure-stack/azure-stack-add-vm-image

Create Managed Image

Generalize the VM

The first thing that needs to be done is to generalize the VM using Sysprep. Follow the Microsoft Documentation: https://docs.microsoft.com/en-us/azure/virtual-machines/windows/capture-image-resource#generalize-the-windows-vm-using-sysprep

Create the managed image via the Azure Stack Portal

Note: Creating the managed image from an existing VM please be aware that when the image is captured it make the VM unusable and can’t be undone.

First thing is to go to the Virtual Machine in the Azure Stack Portal. In the overview blade there is a Capture button. The VM should already be powered off since it should have been generalized.

A notification that the VM should have been generalized and that the VM will not function after the capture.

I named the image, created a new resource group for my managed images. I also checked the box for the process to delete the VM once it has been captured.

The process will try to stop the virtual machine. It will also say it was successfully generalized on step 2 of 4. Not sure why since the machine should already be generalized. Step 3 of 4 is creating the image, this will take some time. Step 4 of 4 will delete the VM.

Once complete I will verify that the managed image now exist and is ready for to be used in future VM deployments. Just go to All Resources and sort group by type. There should now be a type Image with the newly created managed image listed.

Deploy VM using Managed Image

I will use the portal again to create a VM from my newly created managed image. In a real life solution if I had created this managed image for my lab use case I would use some automation to deploy multi VM’s at one time. For this blog I will use the portal and only deploy one VM.

Once again open the Azure Stack portal. I went to All Resources and sorted by Group Type. I selected the image that I want to use. In the overview blade you will see the option to create VM.

At this point the steps are exactly the same as if the I were deploying any VM in Azure Stack. Name your VM, Create your username, etc. The one thing I did notice that I need to research was the subscription. I was not allowed to change it. So I will assume that managed images are by subscription only. I will look into that.

Now I have deployed my first VM using my managed image. I have checked and can log on just fine and all my previous customizations exist. Now I can move into a real world scenario and play around a little more.

Final Thoughts

This was a pretty simple and high level blog. As I mentioned there are more ways to make your managed images and more ways to deploy a VM using your managed images. I also need to find out the question about managed images being subscription based only. I will update my blog once I find this information out.



Spread the word. Share this post!