使用 Azure Automation 连接到 ServiceFabric

问题描述 投票:0回答:1

我正试图通过 Azure Automation 使用混合 runbook worker 运行以下测试脚本。

Connect-ServiceFabricCluster -ConnectionEndpoint "the-service-fabric-azure-url" -FindType FindByThumbprint -FindValue "the-thumbprint" -X509Credential -ServerCertThumbprint "the-thumbprint" -StoreLocation CurrentUser -StoreName My -Verbose

$app = Get-ServiceFabricApplication -ApplicationName "fabric:/the-application-name"

Write-Output $app

当我在我的机器上本地运行这个脚本时,它可以工作。当我在虚拟机上使用Powershell会话运行此脚本时,它也能正常运行。

当我将此脚本放入运行簿中,然后通过混合工作组(该工作组指向同一虚拟机,因为只有一个工人注册到该组)运行运行簿时,我得到一个错误。

Connect-ServiceFabricCluster : An error occurred during this operation. Please check the trace logs for more details. At line:1 char:1 +   
Connect-ServiceFabricCluster -ConnectionEndpoint "my-service-fabric-url... +  

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +   
CategoryInfo : InvalidOperation: (:) [Connect-ServiceFabricCluster], FabricException +   
FullyQualifiedErrorId : CreateClusterConnectionErrorId,Microsoft.ServiceFabric.Powershell.ConnectCluster

我需要配置什么才能使混合组能够执行本地Powershell会话已经可以正确执行的相同脚本?


一些额外的信息。

  • ServiceFabric SDK安装在虚拟机上。由于我可以通过Powershell会话从虚拟机连接到ServiceFabric,因此确认SDK在虚拟机上可用。
  • 混合组工作正常。如果我运行一个输出本地机器名称的小型 Powershell 脚本,它将返回我的 Azure 虚拟机的名称,因此我知道它正在我希望它运行的机器上运行。我运行的任何与ServiceFabric无关的脚本都没有问题。
  • 我已确保在虚拟机上安装ServiceFabric证书。在虚拟机上,我可以浏览SF explorer网站,而且我可以通过powershell会话运行脚本,所以我知道证书已正确安装,否则也无法运行。
  • 我还将证书安装到Azure自动化账户本身,但这对我收到的错误没有任何影响。
  • 错误提到要检查跟踪日志,但我不知道在哪里。
  • 服务 Fabric 节点和混合 runbook worker VM 都在同一个虚拟网络上。由于我可以通过Powershell会话从虚拟机连接到ServiceFabric,这似乎不是网络问题。
azure powershell azure-service-fabric azure-automation
1个回答
1
投票

您使用的证书位置是基于运行脚本的用户 (-StoreLocation CurrentUser -StoreName My).

您应该使用可由运行自动化的(任何)帐户访问的位置来代替。

Azure Automation 有 内置 的支持,使用 Get-AzAutomationCertificate 命令。

更多信息 此处.

© www.soinside.com 2019 - 2024. All rights reserved.