Randy Minder
Randy Minder

Reputation: 48402

Unable to stop VMs using Azure Automation

We have an Azure Service Fabric cluster set up and I'm attempting to use Azure Automation to stop the virtual machine scale set and restart on a schedule. The scale set is assigned to a resource group as follows

enter image description here

My Exteral_Start_ResourceGroupNames and External_Stop_ResourceGroupNames, which the ScheduledStartStop_Parent runbook uses is as follows:

enter image description here

You can see the resource group name matches the resource group name for my VM scaleset. My understanding is that when the runbook fires, all VMs in this resource group, and, therefore, the VM set, should be stopped. However, when the runbook fires, it's not finding any VMs to stop.

Can anyone see what's wrong?

Upvotes: 0

Views: 420

Answers (1)

Niels
Niels

Reputation: 1075

Although they are both VMs, "Virtual Machines" and "Virtual Machine Scalesets" are different resource types in Azure. The underlying nodes of a scaleset are not exposed as 'normal' VMs. You could probably modify your start/stop script to find scalesets in those resource groups instead of normal VMs.

To get you started: The powershell command for finding ScaleSets is Get-AzureRmVmss. That page also details how to shut them down.

Upvotes: 3

Related Questions