how to correct or resize vm size in azure
Azure Virtual Machines (VM) is on-demand, scalable, computing resources provided by Microsoft Azure as IAAS. Most of the cloud service providers like AWS and Google provide IAAS related to meet infrastructure demands.Virtual Machine is needed to have more control over the computing environment. Azure VM gives you flexibility of virtualization without maintaining physical machine.Since these services are provided as infrastructure as service so it needs to be maintained after creation. Azure VM used in all environments like Development/Test/QA and Productions as well depending on your requirements.
As you are aware Virtual Machine is the core part of Azure Cloud IAAS offers.Various models of virtual machines provided in ARM to fulfill all the requirements of different category of application deployments . Size determines the amount of compute resources such as CPU, GPU, and memory that are made available to the virtual machine. VM need to be sized appropriately for the expected work load.
As per main advantages of cloud services it’s scalability. In either cases like workload increases, wrong provisioning, or script based deployment in your organization you can resize your VM whenever required.
Obviously there are many way to do same task but here we would like to go through most common one GUI based method via Azure Portal and CLI based.Lets go though some basics first which will help to understand more about the targeted task.
Different Category of Virtual Machines in Azure
How to find available VM sizes in using Azure CLI
To find out available VM sizes in specific location using cli via command az vm list-sizes command. Sample truncated output is as below.
How to Start or Stop VM using Azure CLI
We can start or stop VM using az vm start/az vm stop .Please refer to below snap.
How to get VM Power States using Azure CLI
Before resizing let us see in which state your VM should be. VM may be in various state.There are many way how you can find current status of VM. Windows SA will love to use Azure PowerShell while Unix SA will love using Azure CLI most of the time.In case if you want from GUI Azure Web Portal is your best friend in most of the cases.It depends which way you would like to achieve same objective, you can use any and it is true for all the changes/modification or setup.Below is the snap for various virtual machine status.
How to Correct VM Size in AZURE
As mentioned above let’s see how to resize virtual machine in AZURE using two methods via web portal or CLI.
(A ) How to Correct or Resize Virtual Machine Size in AZURE using Web Portal
1. Login to Azure Web Console using https://portal.azure.com using your credentials.You will have console like below.
2. Click on Virtual Machine from left panel of console.Please see below.
3. You will get screen like below which will give you option to search based on your subscription. You can type your VM name which you need to resize. Once you find your VM click on it. It will open VM.
4. On VM Screen like below. If new VM size in same cluster or other cluster. VM is expected to be rebooted in either case so it is always better to place VM in deallocated state. You can achieve by taking Stop option on this screen. Once Stop completed you can see VM status as deallocated. Please be careful and make sure VM is in stopped/deallocated state before proceeding next step.
5. Select Size Option here (it is from same specific VM as step 4.)
6. You will have below screen based on your subscription .If your target VM type is visible select VM and take below option. Else you can find from here if your machine type is not visible .Finally take Resize option and let resize task completed. This resize option is visible down to machine type.
7. Go to VM Screen described in Step 4 and start the VM. Let task completed. You can login and validate and see the current VM type in same screen. It may take few minute to reflect. You can refresh screen as well to see the current VM type.
That’s all for this topic as of now.
Let’s see how we can achieve same via CLI.
(B ) How to Correct or Resize Virtual Machine in AZURE using Azure CLI
1. Login to your Azure CLI using procedure you have.Considering you have all your access intact and you have VM Contributor role to your profile.
3. If required VM size is available in cluster,VM can be resized in powered-on state of VM, any how VM will be rebooted during the operation.You can use az vm resize command to resize.
Note: When VM is powered back on, data on the temp disk may be removed. The public IP address also changes unless a static IP address is being used.If you are using static IP you need not to worry.
How to Deallocate Virtual Machine in Azure
6. Start VM once resize completed and validate once available.
That’s all for this topic as of now.
Hope this will be helpful…