I ask question about create code via c#: this.
So, my code is:
var _tfsUrl = "http://mytfs.domain.local:8080/tfs/Collection_Name/";
VssCredentials c = new VssCredentials(new WindowsCredential());
using (var connection= new VssConnection(new Uri(_tfsUrl), c))
{
var client = connection.GetClient<TaskAgentHttpClient>();
var agentPools = client.GetAgentPoolsAsync().Result;
var result = client.AddAgentPoolAsync(new TaskAgentPool("Auto test pool_1")).Result; //error !
}
But i have no permissions:
System.AggregateException: 'Web method running: [http://mytfs.domain.local:8080/tfs/Collection_Name/_apis/distributedtask/pools] (POST)pools[distributedtask] E2EId: some_uid'
AccessDeniedException: Access denied. 'UserName' needs Manage permissions to perform the action. For more information, contact the Azure DevOps Server administrator.
So, i try to create agent pool manually and it works!
My usernname have administration rights in 'Agent Pools-> Security'.
My roles are: Build Administrators, Project Administrators, Release Administrators.
Can you tell me , how to resolve this? Thank you!