Upgrading the the Virtual Machine in Azure is performed in difference way than we did in Hyper-V/VMware. In Azure we have different type of predefined VM size to suit different requirement and those are priced differently. So in-order to change VM size in such cases we can use PowerShell to quickly do this task.

  1. First thing you will do is login to your Azure Subscription by typing in below command.
Add-AzureRmAccount

2. Next, get the list of all the Virtual Machines currently running under your subscription and identify the details of the Virtual Machine that you need to resize. So to get the list run below command.

Get-AzureRmVM

Here will be resizing the Virtual Machine named Webapp02. You can see it’s a Basic A2 class VM and we would be resizing it to Standard D1.

3. Now perform the below command to to get the VM Sizes applicable to the VM that we are going to resize.

Get-AzureRmVMSize -ResourceGroupName MainresourceGroup01 -VMName Webapp02

4. Once you have identified the required VM Size, execute below command to perform the VM resize operation.

 $vm = Get-AzureRmVM -ResourceGroupName MainResourceGroup01 -VMName Webapp02

$vm.HardwareProfile.VmSize = "Stanadrd_D1"

Update-AzureRmVM -VM $vm -ResourceGroupName MainResourceGroup01

5. Now verify the final VM Size by performing the below command.

Get-AzureRmVm

Here you can confirm the final size of the Webapp02 size as Standard D1

 

Leave a Reply

Your email address will not be published. Required fields are marked *