配置 TFS2015 构建代理失败,因为未找到代理池。为什么?

Configuring a TFS2015 build agent fails because agent pool not found. Why?

使用现场 TFS2015 提供的 PowerShell 脚本配置构建代理时,脚本出错,因为它无法在服务器上找到代理池。

但是,代理池'default'确实存在。在另一台服务器上,相同的脚本按预期工作,并构建 运行。请参阅下面的脚本输出。

我试过以下:

是什么导致脚本在代理池验证时失败?

PS C:\Windows\system32> E:\Build\agentConfigureAgent.ps1
Enter the name for this agent (default is Agent-SRV001): BUILD002
Enter the URL for the Team Foundation Server (default is: http://[ip-address]:8080/tfs
Configure this agent against which agent pool? (default pool name is 'default'):
Enter the path of work folder for this agent (default is 'E:\Build\agent_work'): E:\Build\Work
Would you like to install the agent as a Windows Service (Y/N) (default is Y): n
Would you like to unconfigure any existing agent (Y/N) (default is N; the agent will be updated):
Configuring agent
Unblocking files Calling agent configure without /RunningAsService
Calling agent configure without /Force
Unable to find a agent pool with the name: default
WARNING: Configure agent failed, but you might fix this problem by configure with /Force.
Would you like to try agent configure again with parameter -Force (Y/N): y
Calling agent configure without /RunningAsService
Calling agent configure with /Force
Unable to find a agent pool with the name: default
E:\Build\agent\ConfigureAgent.ps1 : Configure agent failed. At line:1 char:1
+ E:\Build\agent\ConfigureAgent.ps1 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,ConfigureAgent.ps1

用户帐户 运行 构建过程脚本需要成为 Agent Pool Administrator Accounts 的一部分。

脚本中的错误消息具有误导性。

要解决此错误,我必须将 Windows 用户(即 运行 TFS 构建代理)添加到 "Advanced" 访问级别。这可以在根 TFS 管理服务器(右上齿轮)> 访问级别 UI 下完成。 (http://your-tfs-server-here:8080/tfs/_admin/_licenses) 我对服务器的默认访问级别设置为利益相关者。

@RoeIF 的回答对我有用,但我在找到添加帐户所需的页面时遇到了一些麻烦。这里有一个屏幕截图可以提供帮助: