question

KM-3381 avatar image
0 Votes"
KM-3381 asked LimitlessTechnology-2700 answered

stop/start AlwaysOn Cluster via Azure Automation

I am working on a start/stop of an alwaysOn cluster using an azure automation account. I can't seem to load the failoverclusters module into the automation account to utilize stop-cluster/start-cluster so I'm working on getting a runbook to call a stored PS script, but it seems there should be an easier way.

windows-server-powershellazure-automation
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

tbgangav-MSFT avatar image
0 Votes"
tbgangav-MSFT answered

Hi @KM-3381,

If you meant this module then I would recommend to try importing the module to Azure Automation account as explained here. Or else if you are looking for a way to call a PS script from a runbook then you can follow one of the below 3 approaches:

  1. Hybrid runbook worker i.e., Runbooks in Azure Automation might not have access to resources in other clouds or in your on-premises environment because they run on the Azure cloud platform. You can use the Hybrid Runbook Worker feature of Azure Automation to run runbooks directly on the machine that's hosting the role and against resources in the environment to manage those local resources. Runbooks are stored and managed in Azure Automation and then delivered to one or more assigned machines.

  2. Create an Azure storage account, container and upload a blob i.e., script (say xxxxxxxxxxxx.ps1 file with the content of your script) and then have below code in Azure Automation PowerShell runbook.

  3. Save a script (say xxxxxxxxxxxxxx.ps1) in your local machine (from where it executed without any issues) and have your script as content in that file and then have below code in Azure Automation PowerShell runbook.

For more information with regards to above mentioned 3 approaches, refer answer in this question.

If your use case or scenario is different and if you are looking for something else then please let me know with little more context.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

LimitlessTechnology-2700 avatar image
0 Votes"
LimitlessTechnology-2700 answered

Hello KM,

You should avoid using variables in the Name parameter of Get-AutomationPSCredential. Their use can complicate the discovery of dependencies between runbooks or DSC configurations and credential assets at design time.

Check out the below link for cmdlets

https://docs.microsoft.com/en-us/azure/automation/shared-resources/credentials?tabs=azure-powershell

A similar topic is discussed in the below link, do have a look at it for better understanding.

https://docs.microsoft.com/en-us/answers/questions/277798/azure-automation-account-and-sql-server-vm.html



Hope this answers all your queries, if not please do repost back.
If an Answer is helpful, please click "Accept Answer" and upvote it : )

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.