【问题标题】:How to use Azure Automation to start and stop the Service Fabric Nodes?如何使用 Azure 自动化启动和停止 Service Fabric 节点?
【发布时间】:2017-01-05 06:21:25
【问题描述】:

在我们的项目中,我们希望使用 Azure 自动化来启动和停止 Service Fabric 群集节点。 首先,我们使用:

Enable-ServiceFabricNode -NodeName "Node1" 
Disable-ServiceFabricNode -NodeName "Node1" 

要启动和停止节点,它可以在我的 Windows Powershell 脚本中运行,但是当我们将它添加到 Azure 自动化脚本时,它会显示 “‘Enable-ServiceFabricNode’一词未被识别为 cmdlet、函数、脚本文件或可运行程序的名称。检查名字的拼写……

然后,我们尝试使用 Azure 资源管理器获取规模集 VM,然后启动和停止 VM:

$Cred = Get-AutomationPSCredential -Name '***@***.com'; 
Add-AzureRmAccount -Credential $Cred 
Set-AzureRmContext -TenantId ‘000000-786D-4361-A787-2C398163274F’

InlineScript
{
    Stop-AzureRmVmss -ResourceGroupName "testRG" -VMScaleSetName "Test"
}

它也适用于我的 windows powershell 脚本,但我们尝试将它添加到 Azure 自动化,它显示: “‘Stop-AzureRmVmss’一词未被识别为 cmdlet、函数、脚本文件或可运行程序的名称。检查名字的拼写……

Azure 自动化是使用 Azure Powershell 脚本,对吧?

那么我们有什么方法可以使用 Azure 自动化脚本来启动和停止 Service Fabric 群集节点?

非常感谢!

【问题讨论】:

  • 你有没有得到答案?如何在 Azure 自动化中以静默方式对 SF 集群进行身份验证?
  • 供参考:这个问题在微软论坛here也有提问和回答

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


【解决方案1】:

这是一个本地集群吗?您能否通过运行以下命令来确认是否启用了 Powershell 脚本执行?

Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force -Scope CurrentUser

默认情况下,Windows 会阻止这些脚本运行。要启用它们, 您必须修改您的 PowerShell 执行策略。打开 PowerShell 为 管理员并输入以下命令:

【讨论】:

    【解决方案2】:

    您很可能没有最新的 Azure 模块。您可以按照以下步骤获取最新模块 -> https://docs.microsoft.com/en-us/azure/automation/automation-update-azure-modules

    【讨论】:

      猜你喜欢
      • 2018-02-03
      • 2023-03-14
      • 2021-06-18
      • 2020-08-09
      • 2016-03-22
      • 2015-09-05
      • 1970-01-01
      • 2017-07-19
      • 1970-01-01
      相关资源
      最近更新 更多