Created
January 28, 2016 14:28
-
-
Save MCKLMT/075d55c94f87704979b6 to your computer and use it in GitHub Desktop.
Resize VMs in a Resource Group
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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