How to create Agent Pool in Azure DevOps via C# client?

383 views Asked by At

How to create Agent Pool in Azure DevOps via C# client?

I find some raw rest api for agent pool like this documentation.

But I want to create agent pool via C# client.

Now I use Microsoft.TeamFoundationServer.ExtendedClient library, but can not find the solution.

1

There are 1 answers

2
Shayki Abramczyk On BEST ANSWER

You need also the Microsoft.TeamFoundation.DistributedTask.WebApi nuget package:

VssConnection connection = new VssConnection(new Uri("URL"), new VssCredentials());
var client = connection.GetClient<TaskAgentHttpClient>();
client.AddAgentPoolAsync(new TaskAgentPool("TestPool"));