Score:0

Manage Services within Azure VM from Automation Runbook

cn flag

I'm looking to use Azure Runbooks (powershell) to automate the shutdown/startup process of a few Azure virtual machines. The VM's are running 3rd party reporting tools, some of which take a few minutes to start and stop services.

I was wondering if there's a way to control the services running on Azure VM's using runbooks, i.e the stopping/starting the 3rd party reporting tools I mentioned above. Ideally I'd be able to stop the VM's one at a time but include some powershell code to not proceed to the next VM until service 'xyz' is stopped or started. I'd appreciate any help or suggestions.

Thanks!

Score:2
ng flag

You can use PowerShell remoting to connect to a VM and run PowerShell commands on that VM. However, if you want to do this from Azure Automation runbooks then you would need to create a Hybrid Worker VM in the same network as your VM's to run these tasks on.

PowerShell remoting uses WINRM to talk to the VM, and you don't want to expose this to the internet for Azure Automation to talk to. By running a Hybrid worker you can have this be the one that runs your automation tasks and talks to WINRM over the network.

Alternatively, if you just want to shut down the VM, you can use the Azure PowerShell libraries in Automation to do that, no need for Hybrid worker.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.