How to: Compose an Environment from Deployed Virtual Machines

You can construct a composed environment from existing virtual machines that are hosted on a Hyper-V host using Visual Studio Lab Management. This host must be added to the host group that is used by your team project collection, or you can import a virtual machine to a host that is already a member of the host group.

Composing a virtual environment from existing virtual machines speeds up the process of creating virtual environments to evaluate the features of Visual Studio Lab Management. With this approach you can just use your existing virtual machines to create a new environment. Composed virtual environments have the following properties:

  • Virtual machines in a composed environment can only be used in a single environment. You cannot run multiple copies of a composed environment.

  • If you delete this environment, then the virtual machines are not deleted and the virtual machines can be used for another environment.

  • You cannot use a virtual machine that has any ISOs or floppy disks mounted in a composed environment.

If you want to create golden masters that can be used in multiple environments, or run multiple copies of an environment at the same time, you must create virtual machines and templates that are stored in a specific library share and import these to be used for a virtual environment. For more information about this, see Creating Virtual Environments and Virtual Environments Concepts and Guidelines.

To use your existing virtual machines as part of a lab-ready virtual environment, you must also install the required agents on the virtual machines based on the following capabilities that you require for the environment:

  • Workflow Capability: Create a workflow to deploy your application to your virtual environment by using Team Foundation Build.

  • Testing Capability: Run manual and automated tests using your virtual environment.

The following table shows which agents are required based on the capabilities that you want:

Agent

Workflow

Testing

Lab agent

X

X

Test agent

*

X

Build agent

X

* To run tests as part of your workflow, the test agent is required.

When an environment is composed for a team project, the virtual machines of the environment remain on the Hyper-V host.

To compose a virtual environment from existing virtual machines

  1. Connect to each virtual machine on your project host that you want to add to your virtual environment.

    1. Install the agents that you require for the capabilities that you want as listed in the previous table. For information about how to install the test, lab and build agents, see Installing and Configuring Visual Studio Agents and Test and Build Controllers.

      When you install a test agent, you can use the default account, which is the network service account. You do not have to register the test agent with a test controller when you install. This will be done automatically using the test controller name that you add to the composed environment for the testing capability.

      Note

      It is recommended that these virtual machines that you plan to add to your composed environment are running on the Hyper-V host when you add them. This allows the state of any agents on the virtual machine to be checked.

  2. Open Microsoft Test Manager.

    Note

    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.

  3. Click Lab Center.

  4. Click the Lab tab, click New, and then click Compose virtual environment.

  5. Follow the steps in the wizard and enter the required information. For more information about individual properties of environments, see How to: Connect to a Virtual Environment.

    1. On the Name and location wizard page, type a name and (optional) description for the virtual environment.

      Note

      The name of the environment has to be unique in the project library share or project host group.

    2. To select the host group where the existing machines are hosted that you want to use to compose this environment, select from the drop-down list for Select the location.

    3. (Optional) Click Environment tags, and then type the name-value pairs to track information about the environment being created.

    4. On the Machines wizard page, view the list of available virtual machines from your project host group. Only machines that are not used in another environment are displayed. Select the one that you need and then click Add to environment. Then enter the role for this machine in your environment.

      Repeat this step to add more virtual machines into the environment. You can also add or remove machines from the environment on the Machines wizard page.

    5. (Optional) Change the name of the added virtual machine.

    6. (Optional) On the Machine properties wizard page, click the first virtual machine of the environment. Examine the default values in the Hardware profile tab and change the value of memory if you want. The OS profile tab does not apply to virtual machines. Finally, examine the default values in Machine tags and add or remove any machine-level tags. Repeat this for each virtual machine that you add to the environment.

      Note

      By default, the hardware parameters of the source virtual machine are used to populate these values.

    7. (Optional) On the Capabilities wizard page, select the capabilities that you want for the environment. Configuring a capability for an environment requires that there is an available test or build controller depending on the capability selected, and that agents are installed on the virtual machines as required.

      Note

      You cannot use the network isolation capability with this type of environment.

    8. On the Summary wizard page, review the information.

    9. Click Finish to create the composed environment.

      At the start of the creation process, Lab Management performs a series of validations. 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.

  6. To start this composed environment, select the environment from the list in the Environments view and click Start. The status of the environment will display as Running.

    You can see the status of the capabilities that you enabled in the environment details view. If the capabilities show a blue check mark and a status of Ready, you can now use this environment in your virtual lab to deploy your application or run tests depending on the capabilities that you enabled.

See Also

Concepts

Testing Using Virtual Environments

How to: Configure and Run Scheduled Tests After Building and Deploying Your Application

Deploying An Application to a Virtual Environment

Creating Virtual Environments