【发布时间】:2020-01-03 19:02:52
【问题描述】:
有没有办法在发布期间从实际的 TFS 服务器运行 powershell 脚本?我在 docker 容器中运行构建代理并且它没有加入域,因此 wmi 不允许 docker 容器中的 windows 代理在复制新的工件文件之前停止 web 服务器上的应用程序池,即使我指定了凭据在连接之前。如果我可以从 TFS 2017 服务器运行 powershell 脚本,这个问题就会得到解决。
我得到的错误是:
019-08-30T13:49:44.6542238Z ##[error][<server>.<domain>.com] Connecting to remote server <server>.<domain>.com failed with the following error message
: The WinRM client cannot process the request. If the authentication scheme is different from Kerberos, or if the
client computer is not joined to a domain, then HTTPS transport must be used or the destination machine must be added
to the TrustedHosts configuration setting. Use winrm.cmd to configure TrustedHosts. Note that computers in the
TrustedHosts list might not be authenticated. You can get more information about that by running the following
command: winrm help config. For more information, see the about_Remote_Troubleshooting Help topic.
+ CategoryInfo : OpenError: (<server>.<domain>.com:String) [], PSRemotingTransportException
+ FullyQualifiedErrorId : ServerNotTrusted,PSSessionStateBroken
【问题讨论】:
-
我尝试将 docker 容器的内部 ip 添加到 WSMan 受信任的主机列表中,它仍然不起作用
-
您提出的问题的答案是直接“否”。您实际面临的问题的解决方案更为复杂。您需要将运行容器的机器的 IP 地址添加到受信任的主机上,而不是容器的内部 IP——容器的内部 IP 在 docker 环境之外是无关紧要的。
标签: powershell docker tfs tfsbuild devops