Virtual Machine Manager 2008 R2 had support for Virtual Machine templates (VM templates). At their core, VM templates consist of three main artifacts: one or more virtual disks, a hardware profile (define hardware characteristics of the virtual machine) and a guest OS profile (define Windows Operating System specialization values for the virtual machine). VM templates are great for repeatedly and reliably deploying standalone (read: single) virtual machines, but they suffer from at least three notable limitations:
1. Single Machine: VM templates, by definition, define a single virtual machine. While there are certainly use cases for single virtual machine deployments, when we think about typical business service deployment, it is likely that said deployment spans multiple machines. For example, consider a two tier application with a load balanced Web front end and a SQL Server backend. Even a small deployment of a service of this type would consist of three machines: two load balanced web servers and a SQL server.
2. Limited In-Guest Configuration: While the Guest OS Profile component of a VM template allows users to define basic Windows OS specialization options such as the computer name, initial administrator password and domain join characteristics of the virtual machine, they cannot easily be used to define richer in-guest configuration options such as Windows Server Role/Feature install, application installation or post-install configuration scripts.
3. Fire and Forget: When a virtual machine is deployed from a VM template, the deployed instance maintains no relationship back to the template from which it was provisioned. Over time, this means that it is difficult, if not impossible, to determine if a deployed instance is still compliant with (i.e. matches) the initial configuration specified in the template. What’s more, consider the situation where you defined a standard infrastructure server via a VM template, specified 1GB of memory in the template and then deployed 80 virtual machine instances from said template. What if it turned out that 1GB was not sufficient and that each of those machines really needed 2GB of memory? With a VM template, you’re stuck manually modifying each of the deployed instances, assuming you can even figure out which instances were deployed from that template.
In VMM 2012, we set out to solve each of these problems (and more). Our solution is called a Service template. We’re going to make available a series of Blog posts to walk through Service templates and Service instances. In this post, Part 1, we’ll begin by discussing Service templates and the features they enable and end by creating a template to deploy a two server environment consisting of an IIS Server and a SQL Server.
Virtual Machine Manager 2012 includes a new template type – a Service template – and several new profile types (e.g. Application Profile, SQL Server Profile) which together solve each of the VM template limitations described above. Specifically, Service templates enable:
1. Multi-Machine Modeling: While Service templates can be used to model and deploy a single machine, they can also be used to model a deployment which consists of multiple machines. Consider the example discussed above, a two tier application with a load balanced Web front end and a SQL Server backend. Using a Service template (which is created in our new Service Designer UI), you can model your Web front end as a “tier” of the service and your SQL Server as a second “tier” of the service. Each tier has its own definition such as hardware characteristics, Windows OS specialization values and application deployments (more on that later). Here is our typical two tier application seen in the Service Designer:
2. Rich In-Guest Configuration: Service templates enable a rich set of in-guest configuration options such as Windows Server 2008 R2 (or higher) Role/Feature installation, application deployment (including first class support for MS Deploy, Server App-V and SQL Data-tier applications) and arbitrary payload delivery and script execution (e.g. a custom .cmd file which can install a custom MSI file). You can even complete the installation of a prepared instance of SQL server, meaning that when your Service instance virtual machine is done provisioning it’s a fully configured SQL Server!
3. Template References: When a Service instance is deployed from a Service template, the deployed instance maintains a relationship back to the template (and template version) from which it was provisioned. Over time, this means that it is easy to determine if a deployed instance is still compliant with (i.e. matches) the initial configuration specified in the template. What’s more, recall the situation described above where you defined a standard infrastructure server via a VM template, specified 1GB of memory in the template and then deployed 80 virtual machine instances from said template. By leveraging a Service template for this instead of a VM template, you could easily copy the template, make your hardware modifications and then apply the updated template to the 80 running instances and VMM will take care of shutting the machines down, reconfiguring the memory and starting them back up!
Service Authoring – Standard IIS Server
Just as VM templates have building blocks (Hardware profiles, OS profiles, physical artifacts such as VHDs), so too do Service templates. In addition to the standard building blocks, Service templates can leverage application packages, custom resource packages (more on those in a later blog post) and even VM templates as building blocks. For example, let’s say I need to define what a standard IIS server configuration looks like in my environment. What’s more, I want Service authors to be able to leverage this standard configuration so that all deployed Services use a consistent IIS configuration. I’ll start by creating a VM template which defines the standard IIS server in my environment. After launching the Create VM Template Wizard, I provide the following values:
1. Source: I choose a base Windows Server 2008 R2 SP1 sysprepped VHD from my VMM library
2. VM Template Name: Standard IIS Server
3. Hardware: I specify the standard hardware configuration for IIS servers in my environment
4. Operating System: I provide some sensible defaults, domain join information and also configure the Windows Server Roles and Features which define the standard IIS server in my environment:
5. Applications: Because I want this template to be used as a standard building block, I don’t configure any applications (though if I had a standard IIS configuration script which should run, I could add that here).
6. SQL Server: Because this is an IIS server, I’m not going to have SQL configured so I can skip this page.
7. Summary: Go ahead and create the template:
Service Authoring – Standard SQL Server
Just as I did with my Standard IIS server above, I want my Service authors to be able to leverage a standard SQL server template so that all deployed Services use a consistent SQL configuration. Again, I’ll start by creating a VM template which defines the standard SQL server in my environment. After launching the Create VM Template Wizard, I provide the following values:
1. Source: I choose a base Windows Server 2008 R2 SP1 sysprepped VHD which contains a sysprepped instance of SQL server from my VMM library. For more information on preparing a sysprepped instance of SQL, see Qingbo Cai’s excellent blog post.
2. VM Template Name: Standard SQL 2008 R2 Server
3. Hardware: I specify the standard hardware configuration for SQL servers in my environment
4. Operating System: I provide some sensible defaults, domain join information and also configure any Windows Server Roles and Features which define the standard SQL server in my environment:
5. Applications: Because I want this template to be used as a standard building block, I don’t configure any applications (though if I had a standard SQL configuration script which should run, I could add that here).
6. SQL Server: Because this is a SQL server, I’m going to go ahead and configure a SQL deployment for this template. Again, Qingbo’s blog post referenced above has all the details about deploying SQL servers with the new SQL Profile object available in VMM.
7. Summary: Go ahead and create the template.
Of course, we’ve also introduced monitoring and diagram views for our other new VMM features such as private clouds, IP address pools and Storage pools.
Putting it all Together
So now I have a couple of Service template building blocks. I want to provide my developers with a standard Web-SQL development environment, which should consist of a single IIS server and a single SQL server. With that in mind, I’m going to create a new Service template which allows them to deploy such an environment quickly and reliably. I’ll go ahead and choose to create a new Service template from the VMM library section of the Admin Console and I’ll start with a blank template, providing a name and release:
Now that I’m in the Service Designer UI, I see that my existing VM templates are available as building blocks of my Service template. If I needed to create a new type of VM definition for this service, I could simply use the “Add Machine Tier” option in the ribbon to create a new type of VM for use in my Service. Because I have my Web and SQL VM templates available, all I need to do is drag and drop each on to the Designer canvas:
Once that’s done, I can click the save and validate ribbon action and my template is now ready for use. I can delegate access to the template to the appropriate self-service users and they have one click deployment of a Web Server / SQL Server environment available to them!
I hope this brief overview gave you not only a great overview of Services but also sparked your imagination as to the myriad options for leveraging Services in your environment. In the next part of this series, we’ll walk through modifying the template to make it more customizable by the end user at deployment time and also add a couple of applications to the deployment.
Stephen Baron | VMM Program Manager
App-V Team blog: http://blogs.technet.com/appv/
ConfigMgr Support Team blog: http://blogs.technet.com/configurationmgr/
DPM Team blog: http://blogs.technet.com/dpm/
MED-V Team blog: http://blogs.technet.com/medv/
Orchestrator Support Team blog: http://blogs.technet.com/b/orchestrator/
Operations Manager Team blog: http://blogs.technet.com/momteam/
SCVMM Team blog: http://blogs.technet.com/scvmm
Server App-V Team blog: http://blogs.technet.com/b/serverappv
Service Manager Team blog: http://blogs.technet.com/b/servicemanager
System Center Essentials Team blog: http://blogs.technet.com/b/systemcenteressentials
WSUS Support Team blog: http://blogs.technet.com/sus/
The Forefront Server Protection blog: http://blogs.technet.com/b/fss/
The Forefront Endpoint Security blog : http://blogs.technet.com/b/clientsecurity/
The Forefront Identity Manager blog : http://blogs.msdn.com/b/ms-identity-support/
The Forefront TMG blog: http://blogs.technet.com/b/isablog/
The Forefront UAG blog: http://blogs.technet.com/b/edgeaccessblog/