ServiceFabric 部署。修改托管代理上的主机

ServiceFabric deployment. Modify hosts on hosted agent

我有一个服务结构应用程序,我想通过 VSTS 将其部署到我的一个虚拟机上。我在那里创建的本地集群受证书保护。当我连接到集群时,我必须使用域 mydomain.net 否则连接将不会成功。所以在我的电脑上使用 powershell 我这样连接:

Connect-ServiceFabricCluster -ConnectionEndpoint mydomain.net:19000 -X509Credential -ServerCertThumbprint [thumb] -FindType FindByThumbprint -FindValue [thumb] -StoreLocation CurrentUser -StoreName My

mydomain.net 是私有域 所以告诉我的电脑这个地址是什么意思 我修改了 hosts 文件:

[public ip address of cluster VM] mydomain.net

感谢这个修改,我的电脑知道 mydomain.net 的实际含义,我可以连接到集群。

现在我想使用托管代理在 VSTS 上实现相同的目的。有没有办法告诉托管代理 mydomain.net 实际上是一些 public ip?因为当我在集群连接端点直接使用public ip时,集群不让我进去:

##[error]Failed to authenticate server identity

添加 PowerShell 任务:

$file = "$env:windir\System32\drivers\etc\hosts"
"[public ip address of cluster VM] mydomain.net" | Add-Content -PassThru $file
Get-Content -Path $file