Skip to content

Instantly share code, notes, and snippets.

@MCKLMT
Created January 28, 2016 14:28
Show Gist options
  • Save MCKLMT/075d55c94f87704979b6 to your computer and use it in GitHub Desktop.
Save MCKLMT/075d55c94f87704979b6 to your computer and use it in GitHub Desktop.
Resize VMs in a Resource Group
Login-AzureRmAccount
$ResourceGroupName = "INFLAB"
$NewSize = "Basic_A3"
$vms = Find-AzureRmResource -ResourceGroupName $ResourceGroupName -ResourceType Microsoft.Compute/virtualMachines
foreach ($vm in $vms)
{
$newvm = Get-AzureRMVM -ResourceGroupName $ResourceGroupName -name $vm.Name
$newvm.HardwareProfile.VmSize = $NewSize
Update-AzureRMVM -ResourceGroupName $ResourceGroupName -VM $newvm
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment