TFS 2018 RC1 is now available and with that XAML builds are no longer supported. Consequently, we are updating the support for using Microsoft Test Manager (MTM) with TFS, using Lab Management and automated testing capabilities in MTM is no longer supported in TFS 2018 RC1.
In TFS 2015, we shipped the new scriptable, cross-platform Build and Release Management. Since then, in the several updates to TFS 2015 and TFS 2017 we have continued to evolve the solution, plugging any gaps, addressing feedback and adding new capabilities. Specifically, we have an extensible and easy to use mechanism to manage environments in both public (including Azure and AWS) as well as private clouds (including SCVMM, VMWare, etc.).
This post focuses on how you can achieve Lab Management features using the Build/Release hub in Team Foundation Server and Visual Studio Team Services.
In the new flow, you need to install SCVMM extension on to your VSTS or TFS Server and connect to the SCVMM Server using SCVMM task to create and manage your Virtual Machines. The SCVMM task is available both in build and release.
Here are the list of functionalities supported in lab management which we will walk you through and explain how to achieve the same using Build/Release flow:
- Environment creation and Management
- Build-deploy-test automation
- Self-service creation of network isolated environments
Environment creation and Management
The Lab Center in Microsoft Test Manager supports the ability to manage a library of environment templates as well as provision environments on demand using an SCVMM server. In the new flow, you can use SCVMM task to create VMs, service instances from templates or manage environments etc.
The following table summarizes the typical activities you used to perform in Lab Center, and how you can accomplish them through SCVMM extension.
| Step | Execution flow in Lab Center | Recommended flow |
| Create a lab environment | Select an environment template in the library and deploy it. Provide the necessary parameters to customize the virtual machine configurations. | Using SCVMM task, you can create new virtual machines from templates. |
| Manage lab machines | Open the lab environment, select the machine. You can choose any action and perform on the selected machine. | Using SCVMM task, you can perform various actions like 鈥?Start, Stop, Create Virtual machines and Run custom scripts to perform more advanced operations on the machines. |
| Manage VM checkpoints | Open the lab environment in Environment viewer. Select the option to take a checkpoint or to restore to a previous checkpoint. | Using the SCVMM task, you can create, restore and delete a checkpoint. |
| Connect to machines. | Open the lab environment in Environment viewer. | If you need to connect to the machine physically, you can use SCVMM admin console or DNS/IP to connect remotely. |
1.Creating SCVMM Environments
- Create a release definition and add SCVMM task.
- Select 鈥淐reate VM from template鈥澛?action and provide the comma separated list of VMs to be created. You can choose to deploy the VMs on a Host Group or Private Cloud.
- Trigger a Release to deploy the Virtual Machines.
If you have a complex setup to be created, you can extract the setup configuration from SCVMM as SCVMM PowerShell commandlets which can be executed using SCVMM task with 鈥淩un Custom PowerShell鈥?action.
2. Manage VMs:
- Create a release definition and add SCVMM task.
- From the list of actions, you can select various actions 鈥淪tart/Stop VM鈥澛? 鈥淐reate VM from template鈥澛? 鈥淐reate/Restore/Delete Checkpoint鈥澛?/EM> actions.
You can use Variable groups to store your environment details like VM names, Host machines, Templates, Username, Passwords, Checkpoints etc. These Variables can be used in your SCVMM task. Variable groups can be used across build and release definitions in your projects.
3. Connect to the machines
- To connect to the machines physically you either need to view the machine from SCVMM Admin console or connect remotely using DNS/IP.
- However, you can also add the VMs/Machines into a Deployment Group in VSTS/TFS. You can monitor the health of the machines and run your app deployments/tests on them.