无法从Azure自动化脚本连接到服务结构群集

时间:2017-12-21 12:50:25

标签: powershell azure azure-service-fabric azure-automation

我尝试从Azure自动化PowerShell Runbook连接到Azure Service Fabric群集。我知道有一种混合Runbook方法可能可以解决这个问题(c.f。this)但是由于我正在研究的项目的具体原因,我宁愿不使用它。 相反,我使用了here描述的方法将SF模块导入我的自动化帐户。这使Connect-ServiceFabricCluster cmdlet可供我使用,但在执行时无法连接。我已经设置了一个非安全的测试集群,这是Runbook代码:

Import-Module "ServiceFabric" # not sure this is needed...
$connectionName = "AzureRunAsConnection"

# Get the connection "AzureRunAsConnection "
$servicePrincipalConnection=Get-AutomationConnection -Name $connectionName         

"Logging in to Azure..."
Add-AzureRmAccount `
    -ServicePrincipal `
    -TenantId $servicePrincipalConnection.TenantId `
    -ApplicationId $servicePrincipalConnection.ApplicationId `
    -CertificateThumbprint $servicePrincipalConnection.CertificateThumbprint 


"Test connecting to cluster..."
Connect-ServiceFabricCluster -ConnectionEndpoint 
'[myclusterendpointurl]:19000'
"Done!"

在测试窗格中运行(或作为常规作业运行,无所谓)时,执行脚本的三次尝试都会完成,每次都记录到输出:

Logging in to Azure...

Environments                                                                                                            

------------                                                                                                            

{[AzureChinaCloud, AzureChinaCloud], [AzureCloud, AzureCloud], 
[AzureGermanCloud, AzureGermanCloud], [AzureUSGovernme...

Test connecting to cluster...

直到完成并出现错误:

The runbook job was attempted 3 times, but it failed each time.  Common 
reasons that runbook jobs fail can be found here:  
https://docs.microsoft.com/en-us/azure/automation/automation-troubleshooting-automation-errors

Connect-method似乎超时而没有记录任何输出。这里发生了什么?

0 个答案:

没有答案