Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Introduction
In this post we read how we can easily Start, Stop, or Restart massively Azure virtual machines.
There are many times where we need to massively do operations on Azure VM's, in this post we would talk how we can Start, Stop, and Restart VM's via Azure Portal or Azure PowerShell.
Start, Stop VM's via Azure Portal
Start, Stop VM's via Azure Cloud Shell
Please check below the Azure PowerShell scripts to Start, Stop, and Restart massive Virtual Machines.
#Start Azure VMs
$ResourceGroupName = "MyVMRG"
Get-AzVM -ResourceGroupName $ResourceGroupName | Select Name | ForEach-Object { Start-AzVM -ResourceGroupName $ResourceGroupName -Name $_.Name }
#Stop Azure VMs
Get-AzVM -ResourceGroupName $ResourceGroupName | Select Name | ForEach-Object { Stop-AzVM -ResourceGroupName $ResourceGroupName -Name $_.Name }
#Restart Azure VMs
Get-AzVM -ResourceGroupName $ResourceGroupName | Select Name | ForEach-Object { Restart-AzVM -ResourceGroupName $ResourceGroupName -Name $_.Name }