To create virtual environments in Microsoft Test and Lab Manager, you first need to have virtual machines in your project library share. Lab Management does not provide the functionality to create fresh virtual machines. You have to use Hyper-V or SCVMM in order to create these initial or golden virtual machines, and then "import" them into a project. The import in Beta1 is done by 'creating a new virtual machine' using Microsoft Test and Lab Manager.
Before moving further, let me clarify that the terminology used in Beta1 is changing for our next release. A lot of customers said that they were confused about the use of our phrase 'create new virtual machine' in library. For this blog, I will make two clarifications and continue to use Beta1 terminology. First, when we "create a new virtual machine" in a project library share, we are just importing a virtual machine managed by SCVMM into lab. We are not really creating a fresh copy of the virtual machine. Second, our term virtual machine in project library share can refer to either a Virtual Machine or a Virtual Machine Template in SCVMM. Thanks to your feedback, we are going to clean this up and remove some of the confusion surrounding this in Beta2.
Coming back to our topic, in order to import a VM into lab, you either need to have a virtual machine or a virtual machine template already in SCVMM library. So, the question is, how to create a VM or a VM template in SCVMM library?
There are several ways and some of our customers (especially those who are new to SCVMM) were asking for best practices around this. In this blog, we will talk about some of these practices. If you have discovered something else that works for you, please share it with us and the rest of the community.
In order to create a VM or VM template in SCVMM, you can start from one of the following:
(a) Scratch: You have got nothing. You want to create a fresh VM, then install OS, and any applications + agents into that VM.
(b) An existing VHD: You have a VHD that already has the OS, applications, and agents installed. You need to turn this into a VM or VM template that can be later used in Lab Management.
(c) An existing physical machine: You have a physical machine that you want to convert into a virtual machine and then use that to create environments in Lab Management.
You need to decide whether you would like to import a VM or a VM Template -
You can think of the VM as a 'fully baked' computer. It will have OS, apps, and agents installed; it has a computer name, an IP address, etc. When you import a VM into lab and use it to create several copies of environments, you need to use network isolation - a feature in Lab Management that prevents network conflicts. The advantage of using VMs is that you will get exact replicas of what you have created and it saves you time from re-installing or re-configuring your application.
A VM Template is a 'half baked' computer. The OS inside the VM is generalized by running a tool called Sysprep, which essentially removes the instance specific information from the image. When a VM Template is imported into lab, you can use it create multiple copies of the environments without network isolation feature. Each copy of the VM is customized with a unique computer name so that there are no network conflicts.
To summarize, create a VM in SCVMM library if you plan to use network isolation or don't plan to clone environments. Create a VM Template in SCVMM library if you do not plan to use network isolation.
Recommended approaches for creating VMs and VM Templates
The following table shows the starting points on the left and targets on the top. Find the box that suits your needs and see the recommended approach for creating a VM or VM Template. Each step is usually a hyperlink to more detailed documentation in SCVMM or Hyper-V.
Virtual Machine Template
Using SCVMM Admin Console
(OR) Using Hyper-V Manager
This article does not cover how to install lab or other agents into your golden VMs. For more information about this, please refer to the lab setup guide.
Whenever you use Hyper-V to create a VM and export it, you have to perform the following additional steps to be able to use the VM from SCVMM or Lab Management.
Now that you have a VM or VM template in SCVMM library share, go to Microsoft Test and Lab Manager -> Lab Center -> Library -> Virtual Machine Templates and import it by clicking on 'New'. Once the VM or VM Template is imported into lab, you can use it in creating environments.