1
votes

In our project, we want to use Azure Automation to start and stop Service Fabric Cluster nodes. At first, we use the:

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

To start and stop the Nodes, it works in my Windows Powershell Script, but when we add it to the Azure Automation Script, it show “The term ‘Enable-ServiceFabricNode’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name …

Then, we try to use the Azure Resources Manager to get the scale set VM, then start and stop the 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"
}

Also it works in my windows powershell script, but we try to add it to Azure Automation, it shows: “The term ‘Stop-AzureRmVmss’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name …

The Azure Automation is use the Azure Powershell Script, right?

So is there any way that we can use the Azure Automation Script to Start and Stop the Service Fabric Cluster nodes?

Thanks so much!

2
did you even got an answer? how to auth silently to the SF cluster in Azure Automation?4c74356b41
For reference: This question was also asked and answered on the microsoft forum heresmeel

2 Answers

0
votes

Is this an on-premise cluster? Can you confirm if you enable Powershell script execution by running command below?

Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force -Scope CurrentUser

By default, Windows blocks these scripts from running. To enable them, you must modify your PowerShell execution policy. Open PowerShell as an administrator and enter the following command:

0
votes

You most likely don't have the latest Azure Modules. You can get the latest modules by following these steps -> https://docs.microsoft.com/en-us/azure/automation/automation-update-azure-modules