How to: Create an Environment from Virtual Machines or Templates

You can create virtual environments from stored virtual machines, templates, or stored environments. A virtual environment is a collection of virtual machines or templates that is controlled by Visual Studio Lab Management. This topic describes how to create virtual environments from stored virtual machines and templates.

  • You create deployed environments on the host groups in your team project lab. A deployed environment contains only virtual machines and can be running or stopped. When an environment is created on a team project host group, the virtual machines of the environment are hosted on one or more Hyper-V hosts. When the environment is started, the corresponding virtual machines are started and you can interact with those virtual machines.

    Note

    You can also compose an environment from virtual machines that were created outside of Lab Management and are located on a Hyper-V host. For more information, see How to: Compose an Environment from Deployed Virtual Machines.

  • You create stored environments in your team project library. A stored environment is used to create new virtual environments. A stored environment can contain virtual machines or templates. When an environment is created on a team project library share, the virtual machines or templates of the environment are stored on the disk of the SCVMM library server. A stored environment is a passive set of files. Until the environment is deployed onto a team project host group, you cannot do anything more with it. For information about how to create deployed environments from stored environments, see How to: Deploy a Stored Environment.

You create environments from the following sources in the team project library:

  • One or more templates.

  • One or more stored virtual machines

  • A combination of stored virtual machines and templates

Usually, a best practice is to only stored virtual machines or only templates in your library. For more information, see the Guidelines For Stored Virtual Machines and Templates section of Virtual Environments Concepts and Guidelines.

Creating an Environment From Templates or Stored Virtual Machines

Creating an environment from templates or stored virtual machines involves three steps.

  1. If it is necessary, add and configure virtual machines and templates to use in the environment to the project library.

  2. Create the environment and then add and configure the templates or virtual machines.

  3. If you are creating a deployed environment from stored virtual machines that does not use network isolation or if you are creating a deployed environment that uses network isolation and a private domain, you need to perform additional configuration after the environment is deployed.

    • For information about how to configure an environment that was created by using stored virtual machines, see Creating Deployed Environments That Do Not Use Network Isolation From Stored Virtual Machines.

    • For information about how to configure an environment that uses network isolation, see How to: Create and Use a Network Isolated Environment.

To add and configure virtual machines and templates in the project library

  1. Open Microsoft Test Manager.

    To display the Microsoft Test Manager window, click Start, and then click All Programs. Point to Microsoft Visual Studio 2010 and then click Microsoft Test Manager.

  2. Click Lab Center.

  3. Click the Library tab, and then click Virtual Machines and Templates.

  4. Add the virtual machines and templates for the environment to the Library.

  5. If it is necessary, set the properties of the templates. For more information, see How to: Set the Properties of a Virtual Machine or Template. You can also set the properties as you add the stored virtual machines or templates to the environment.

To create an environment from virtual machines or templates

  1. Do one of the following:

    1. To create an environment to store in the library, click the Library tab, click the Environments sub-tab, and then click New.

    2. To create an environment for deployment, click the Lab tab, click New, and then click Virtual environment.

  2. In the New Virtual Environment wizard, click the Name and location step, and then specify the following properties of the environment:

    Lab Management Environment Wizard - Name Page

    Environment PropertyDescription
    NameA user-friendly name for the environment. Avoid using commas in the name. A comma in the environment name prevents the build controller from communicating with the build agent.
    DescriptionAdditional information about the environment.
    Select the locationIf the environment is to be deployed to the Lab, select the host group that hold the virtual machines. If the environment is to be stored in the library, select an SCVMM library share that has been assigned to the project.
    Environment TagsA set of name-value pairs that provide additional information about the environment.
  3. Click the Machines step.

    Lab Management Environment Wizard - Machines Page

    For each virtual machine that you want to add to the environment, click the name of the template in the right side pane, and then click Add to environment. Notice that you can add a single template or virtual machine to an environment multiple times.

  4. Each virtual machine or template in an environment must have a unique name. If it is necessary, select the virtual machine, click Rename, and then enter a new name.

  5. Optional. Change the default role of the virtual machine or template. A role identifies the function of the machine in the environment and is used by Test Manager to determine the testing data to collect. Select the virtual machine or template, click Edit Role and then select or enter a role.

  6. Optional. Change the properties of the deployed virtual machines. Click the Machine properties step.

    LM Environment Wizard - Machine Properties Page

    Select the deployed machine. Use the tabs on the wizard page to change the following properties.

    TabMachine Properties
    Hardware profileThe amount of memory to assign to virtual machines created from the virtual machine or template.
    OS profile (templates only)Operating system type, computer name, administrator password, product key, domain, and workgroup for virtual machines deployed from the template.
    Machine tagsUser-defined custom properties to track for the stored virtual machine or template.

    For more information, see How to: Set the Properties of a Virtual Machine or Template.

  7. Optional. Click the Capabilities step.

    Ee518915.LM_EnvWiz_Capabilities(en-us,VS.100).png

    Select or clear the following options:

    CapabilityDescription
    Run tests on this environmentEnables you to run tests and collect logs on the machines in the environment. To use this capability, you must install a test agent on each virtual machine where you will run the tests. For more information about the testing capability, see Testing Using Virtual Environments.
    Run workflows on this environmentEnables you to run application deployment workflows on the machines in the environment. To use this capability, you must install the build service host and a lab agent on each machine in the environment. For more information about the workflow capability, see Deploying An Application to a Virtual Environment.
    Enable network isolation for this environmentThe network isolation capability enables you to use multiple copies of the same virtual environment without name or IP address conflicts. To use this capability, you must install a lab agent on each virtual machine in the environment. For more information about the network isolation capability, see How to: Create and Use a Network Isolated Environment.
  8. Click the Summary step to review you choices. Then click Finish to create the environment.

At the start of the creation process, Lab Management performs a series of validations. This includes verifying that there is enough capacity on hosts to create the environment when an active environment is being created.

  • If any of the validations fail, you will be presented with information about the failures. At that point, you can correct the information in the wizard, and try the creation operation again by clicking Create.

  • If the validations succeed, the creation process is automatically initiated. During the creation process, a progress bar is displayed to indicate the progress of creation. You can also view the current creation step displayed under each virtual machine.

Creating Deployed Environments That Do Not Use Network Isolation From Stored Virtual Machines

To avoid network name conflicts, a best practice is to create stored virtual machines as workgroup machines. If you create a deployed environment that does not use network isolation, you should follow these steps to change the computer names of the machines and join them to the domain.

  1. In the Lab tab of Test Manager, select the environment and then click Start.

  2. After the environment has started, click Connect.

  3. In Environment Viewer, follow these steps for each virtual machine that was created from a stored virtual machine:

    1. Select the machine and then click Connect.

    2. Log on to the machine using an account that has administrator privileges on the machine.

    3. Open the System Properties dialog box.

      Click Start, click Computer, and then click System properties. On some versions of Windows, you must then click Change Settings in the System explorer window.

    4. On the Computer Name tab of the System Properties dialog box, click Change.

    5. Enter a name that is unique to the network in the Computer name box.

    6. Click Domain and enter the fully qualified name of the domain. You will be prompted for the name and password of an account that is allowed to join computers to the domain.

See Also

Concepts

Creating Virtual Environments

Change History

Date

History

Reason

March 2011

Added an instruction to avoid using commas in the name of the environment.

Customer feedback.