Getting Started With Azure Pack (Part 9)

by [Published on 15 Dec. 2015 / Last Updated on 15 Dec. 2015]

This article continues the discussion of Azure Pack by examining the process for building a VM template that can be used to automate the virtual machine creation process.

If you would like to read the other parts in this article series please go to:

In the previous article in this series, I talked about some of the requirements for building VM templates and I also discussed some of the potential risks associated with using Microsoft’s SYSPREP utility. In this article, I will continue the discussion by walking you through the process of building a VM template and a corresponding guest OS profile.

When creating a VM template, I like to begin the process by creating a hardware profile. A hardware profile is simply a profile that allows you to define a standard virtual hardware configuration. Imagine for a moment that you plan to create ten different VM templates that will be used to generate ten different types of Windows VMs. If all of these templates will use the same hardware configuration then you could create a single hardware profile that will be used by all of the templates rather than having to manually define each template’s hardware configuration.

To create a hardware profile, open the Virtual Machine Manager console and go to the Library workspace. Next, right click on the Hardware Profile container and select the Create Hardware Profile command from the shortcut menu. This will cause Windows to display the New Hardware Profile dialog box.

The New Hardware Profile dialog box contains two tabs. The General tab requires you to enter a name for the hardware profile that you are creating and to choose whether the profile will be used to create Generation 1 or Generation 2 virtual machines. This tab also gives you the option of entering a description of the profile.

The dialog box’s other tab is the Hardware Profile tab. This tab is where you define the hardware resources that virtual machines that will eventually be based on the profile will use. This process works in exactly the same way as assigning hardware resources to a Hyper-V virtual machine. For instance, you might assign memory and a specific number of virtual processors to the hardware profile. When you are done configuring the profile, click OK and the profile will be created.

The next thing that we need to do is to create a Guest OS Profile. As explained in the previous article, a Guest OS Profile is very similar to a SYSPREP answer file. You can create a Guest OS Profile by going to the Library workspace, right clicking on the Guest OS Profile container, and selecting the Create Guest OS Profile command from the shortcut menu. Upon doing so, Windows will display the New Guest OS Profile dialog box.

Like the New Hardware Profile dialog box, the New Guest OS Profile dialog box is divided into two tabs. The first tab requires you to enter a name for the profile. You should also set the Compatibility option to Microsoft Windows. It is also a good idea to enter an optional description.

The other tab is the Guest OS Profile tab. This tab allows you to provide answers to all of the questions that are normally asked during Windows setup. You can for example, specify the version of Windows that the Guest OS Profile will apply to and enter a product key and an administrator password. You can even set the server’s domain and time zone.

Keep in mind that you can create multiple Guest OS Profiles to help you to deploy different types of servers. If for example, you wanted to automate the deployment of a Web server, you could design a Guest OS Profile that would deploy the required roles and features.

When you finish configuring the Guest OS Profile, click OK and the Guest OS Profile will be created. Now it’s time to create a VM template. The process of creating a VM template is very similar to that of creating a virtual machine. Begin by going to the VMs and Services workspace, right clicking on a Hyper-V host, and selecting the Create Virtual Machine command from the shortcut menu. This will cause Windows to launch a wizard that will walk you through the virtual machine creation process.

For the most part, the virtual machine creation process is identical to that of creating any other virtual machine. However, when you arrive at the Configure Hardware screen, choose a previously created hardware profile rather than manually configuring the virtual machine’s hardware allocations.

With that said, go ahead and finish creating the virtual machine and install a Windows operating system on it. Once the new virtual machine is up and running, it is a good idea to install all of the latest operating system patches. Remember, this virtual machine will serve as a model for virtual machines that will be created in the future. You really don’t want to have to install hundreds of OS patches for every virtual machine that is created from the image that you are about to build. You can save yourself a lot of time by doing the patching up front. While you are at it, I recommend installing any required backup agents or anti-malware software.

Now it’s time to convert the virtual machine into a VM template. To do so, go to Virtual Machine Manager’s Library workspace. Right click on the VM Templates folder and choose the Create VM Template command from the shortcut menu. This will cause Windows to launch a wizard that will walk you through the template creation process.

On the wizard’s initial screen, choose the option to create a template from an existing virtual machine, and then use the Browse button to choose the virtual machine that you just created. It is very important not to create a template from a production VM because the virtual machine will be destroyed in the process.

Click Next and you will be prompted to assign a name and description to the template. After doing so, click Next.

The next screen that you will see is the Configure Hardware screen. You shouldn’t have to do anything here because this screen inherits the settings from the virtual machine on which you are basing the template.

Click Next and you will see the Configure Operating System screen. Select your Guest OS Profile and click Next.

You will now be promoted to select a library server. Choose the Virtual Machine Manager library server where you want to store the template and click Next.

The next screen that you will see is the Select Path screen. You can use this screen to choose the folder within the library where you want the template to be stored. When you are done, click OK, followed by Next.

You should now see a summary screen. The summary screen really doesn’t give you any significant information to review, so just click Create to build the VM template.

Conclusion

In this article, I have explained how to create a new VM template. This template can be used as a mechanism for automated virtual server deployments. In the next article in this series, I will show you how to add this template to Azure Pack so that your end users can use it to build new virtual machines.

If you would like to read the other parts in this article series please go to:

See Also


The Author — Brien M. Posey

Brien M. Posey avatar

Brien Posey is an MCSE and has won the Microsoft MVP award for the last few years. Brien has written well over 4,000 technical articles and written or contributed material to 27 books.

Advertisement

Featured Links