1
votes

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

1 Answers

2
votes

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"));