Create Lab Environment using TFS Lab Management APIs

Create Lab Environment using TFS Lab Management APIs

  • Comments 3

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using Microsoft.TeamFoundation.Client;

using Microsoft.TeamFoundation.Lab.Client;

namespace LabEnvironmentCreation




        staticvoid Main(string[] args)


            //Get reference to lab service

            TfsTeamProjectCollection tfsServer = newTfsTeamProjectCollection(TfsTeamProjectCollection.GetFullyQualifiedUriForName("http://<ATName>:8080/tfs"));

            LabService labService = (LabService)tfsServer.GetService(typeof(LabService));

            //Create Lab System Definition List

            List<LabSystemDefinition> lsdList = newList<LabSystemDefinition>();

            LabSystemDefinition lsd = new LabSystemDefinition("MachineName", "LSDName", "RoleOfMachine");

            lsd.Description = "Add Some Description";

            //Add Lab System to List


            //Create Lab Environment Definition

            LabEnvironmentDefinition led = new LabEnvironmentDefinition("EnvironmentName", "Environment Description", lsdList);

            led.TestControllerName = "NameOfTestController:Port"; //Example <TCName>:6901

            //Create Lab Environment

            LabEnvironment Le = LabService.CreateLabEnvironment("ProjectName", led, null, null);           





Leave a Comment
  • Please add 1 and 4 and type the answer here:
  • Post
Page 1 of 1 (3 items)