Resize an Azure VM
It is hard to get the right size, the first time.
There can be any amount of reasons for resizing a VM in Azure.
# Azure CLI
# Get available sizes for current VM
az vm list-vm-resize-options --resource-group <resourceGroup> --name <vmName> --output table
# Deallocate VM
az vm deallocate --resource-group <resourceGroup> --name <vmName> --output table
# Resize VM
az vm resize --resource-group <resourceGroup> --name <vmName> --size <newSize> --output table
# Start the VM
az vm start --resource-group <resourceGroup> --name <vmName> --output table
# Azure PowerShell
# Get available sizes for current VM
Get-AzVMSize -ResourceGroupName <resourceGroup> -VMName <vmName>
# Get VM
$vm = Get-AzVM -ResourceGroupName <resourceGroup> -VMName <vmName>
# Change VM size
$vm.HardwareProfile.VmSize = "<newSize>"
# Update VM
Update-AzVM -VM $vm -ResourceGroupName <resourceGroup>