【发布时间】:2020-03-18 19:11:57
【问题描述】:
脚本中的以下 powershell sn-p 在本地机器上运行良好:
$SharepointConnection = Connect-PnPOnline -Url $ConfigInfo.AProcessDef.ASharePointUrl.ToString().Trim() -Credential $SharepointCredential -ReturnConnection -Verbose -ErrorAction Stop
但是,当 Azure DevOps 构建代理(代理服务器后的自托管代理)在构建 VM 机器上运行相同的 sn-p 时,它会失败。构建机器位于代理后面,并且已经配置。我已经检查过 InvokeWebRequest 以访问组织的本地 Intranet 和 Internet,它运行良好。 Connect-PnPOnline 出现以下异常:
System.Net.WebException The remote name could not be resolved:
我登录了 vm 机器,执行了 sn-p 没有任何错误。我可以连接到 domainname.sharepoint.com。
感谢一些提示来解决这个问题。
【问题讨论】:
-
错误`System.Net.WebException The remote name could not besolved:`通常表示代理或DNS有问题。如果在本地ping url
ping xxx.com并使用self-agent 调用命令ping some-domain-that-doesnt-exist.com的命令行任务,结果如何?有什么区别吗?
标签: azure-devops sharepoint-online