There are so many benefits to the cloud, but one of the major features is the ease of use in scaling a virtual machine (VM). A common scenario is when you are building an application that needs SQL Server. Simply create a VM on the Azure portal that has SQL Server already installed (or choose an OS-only VM and install SQL Server on your own if you will be bringing a SQL Server license over). When choosing the initial VM, choose a smaller VM size to save costs. Then as your application goes live, scale the VM up a bit to handle more users. Then watch to see the performance of SQL Server. If you need more resources, scale the VM up again. If you scale too much so the VM is being under utilized, just scale it back down.
All this scaling can be done in a few mouse clicks with the resizing taking just a few minutes (or even just a few seconds!). Compare this to scaling on-prem: review hardware, order hardware, wait for delivery, rack and stack it, install OS, install SQL Server, then hope you did not order too much or too little hardware. It can take weeks or months to get up and running! Then think of the pain if you have to upgrade the hardware: repeat the same process above, then backup and restore the databases, the logins, sql agent jobs, etc, and restore them on the new server and repoint all the users to the new server. Ugh!
Let me quickly cover the process of scaling a VM in Azure to show you how easy it is. First you select your VM in the Azure portal and choose “Size” under Settings:
Under “Choose a size” will be a list of all the available VM sizes you can scale to. Some VMs may not appear in the list if you are in a region that does not support them, so keep this in mind when choosing the region for your initial VM:
Some of the VMs in the “Choose a size” list will be “active”, meaning you can select them, and resizing requires just a VM reboot. The VMs that are active depends on if the current VM size is in same family (see list below), or if the Azure hardware cluster that the current VM resides in supports the new VM size (which you are not able to tell ahead of time – click here for more info):
If you see VMs in the “Choose a size” list that are grayed out and not selectable, it means the VM is not in the same family and the hardware cluster does not support the new VM size. No problem! If you are using the Azure Resource Manager (ARM) deployment model you can still resize to any VM, you just need to first stop your VM. Then go back to the “Choose a size” list and you will see all the VMs are now active and selectable. Just remember to restart the VM when the scaling is complete.
Resizing a VM deployed using the Classic (ASM) deployment model is more difficult if the new size is not supported by the hardware cluster where the VM is currently deployed. Unlike VMs deployed through the ARM deployment model it is not possible to resize the VM while the VM is in a stopped state. So for VMs using the ASM deployment model you should delete the virtual machine but select the option to keep the attached storage (OS and data disks) and then create a new virtual machine in the new size and reattach the disks from the old virtual machine. To simplify this process, there is a PowerShell script to aid in the delete and redeployment process.
So once you choose the VM to scale to, you will see:
and in a few minutes, or even seconds if the VM is stopped, you will see:
If you needed to stop your VM, the next step is to restart it. If you did not need to stop it, you are ready to go!