TFS 2018发布管道中目标计算机上的PowerShell失败

时间:2020-05-04 08:32:36

标签: powershell tfs azure-pipelines-release-pipeline

我是TFS2018的新手,我正在尝试配置CI / CD管道。我的构建成功,并且在发布管道中,我需要在部署服务器上运行powershell脚本,因此我在“目标计算机”任务上使用了RUN PowerShell。我想,正确提供了所有必需的信息并运行了发行版,但在此任务中出现了如下错误

Connecting to remote server xxx.xxx.xx.xx failed with the following error message : The WinRM client cannot process the request. Default authentication may be used with an IP address under the following conditions: the transport is HTTPS or the destination is in the TrustedHosts list, and explicit credentials are provided. Use winrm.cmd to configure TrustedHosts. Note that computers in the TrustedHosts list might not be authenticated. For more information on how to set TrustedHosts run the following command: winrm help config. For more information, see the about_Remote_Troubleshooting Help topic.

请在下面找到我的任务配置

enter image description here

enter image description here

我尝试将TFS2018服务器添加为目标服务器上的TrustedHost,但仍然存在问题。请提出建议和帮助。

2 个答案:

答案 0 :(得分:0)

这就是所谓的PowerShell双跳问题,通常意味着您试图使用用户凭据运行时使用不同的凭据登录到远程计算机。因此,在您的情况下,$(adminUserName)是否与代理相同?如果不是,那么您可以尝试将该用户更改为与代理相同。如果不是,那么您需要做更多一点,然后将计算机添加到trustedHost。在SPN上观看此视频可能会帮助https://www.youtube.com/watch?v=yFgdPcLOs-g,这是有关双跳问题https://docs.microsoft.com/en-us/powershell/scripting/learn/remoting/ps-remoting-second-hop?view=powershell-7

的详细说明

答案 1 :(得分:0)

  1. 通过Powershell将TFS服务器计算机添加到目标计算机中的TrustedHost。
    Set-Item WSMan:localhost\client\trustedhosts -value ServerDC

  2. 确保此任务中提供的凭据具有管理员角色,并且在这种情况下,它们同时可以访问TFS。如果提供的凭据没有TFS管理员特权,则该任务将无法调用代理程序来触发VisualStudioRemoteDeployer