Learn this information to learn to scale an Azure Spot discounted VM up or down (vertical resize).
Overview of Azure Spot VMs
When deploying an Azure VM, you might be able to use Azure Spot. This lets you set the hourly value you wish to pay.
Azure Spot affords this feature if it has capability, however when the capability is required or the value modifications resulting from demand, the VM will both be stopped/deallocated or deleted, relying on the choice you selected once you arrange the Azure Spot low cost.
If you happen to attempt resizing the VM after creating it, you might not be capable to as a result of the utmost value you set for the VM is decrease than the value of the brand new dimension.
On this state of affairs, you need to improve the utmost value you’re keen to pay for the Azure Spot VM. Within the remaining a part of this information, I’ll stroll you thru the steps to cease/deallocate, improve the utmost value provide, and resize it.
Step 1: Get a Quote for the New VM SKU
- Open the VM you wish to resize, increase its Availability + scale blade, and navigate to Dimension. After that, choose a brand new dimension for the VM and select Resize.
- The operation ought to throw an error, together with the minimal value it is best to set. Within the screenshot under, I’ve highlighted the quote (0.04116) I used to be provided.

If the Resize button is grayed out after choosing any accessible sizes, you’ve got run out of the Spot low cost for that dimension. See step 2 under for find out how to proceed.

- Scroll down, increase the Inadequate quota – spot restrict part, and click on the Request quota subsequent to one of many accessible VM SKUs.

- Then, on the New Quota Request fly-out window, settle for the really useful quota restrict or enter one other worth, and click on Submit.
If the request fails, open a assist ticket.

Step 2: Cease (Deallocate) the VM
You can not modify the utmost value provide of an Azure Spot discounted VM whereas it’s operating. So, step one is to cease the VM with the steps under:
- Click on the VM’s Overview blade, click on Cease, and ensure the operation.


- Verify that the VM has stopped by clicking the notification icon on the highest menu.

Step 3: Improve the Azure Spot VM’s Most Worth
Now that you’ve stopped the VM, you possibly can improve the utmost value you wish to pay to the value you obtain in Step 1 by operating the next PowerShell instructions.
Run the command through Azure Cloud Shell PowerShell.

#1: Get the VM settings
$VM = Get-AzVM -ResourceGroup "<ResourceGroupName>" -Identify "VM title>"#2: Set a brand new Azure Spot most value
#Microsoft provided me 0.04116. I set my value at 0.0412 so mine provide is barely above the quoteReplace-AzVM -ResourceGroupName "<ResourceGroupName>" -VM $VM -MaxPrice <New most value>
#3: Lastly, begin the VM
Begin-AzVM -ResourceGroupName "<ResourceGroupName>" -Identify "VM title>"
Here’s a screenshot of the above instructions in my Azure Cloud Shell.

Step 4: Scale Up or Down (Resize) the VM
Return to the VM’s Availability + scale > Dimension blade, choose the brand new dimension (SKU), and select Resize.

Monitor the progress of the resize operation through the notification window.

Conclusion
Azure Spot is nice for creating discounted VMs for lab and check environments. Nevertheless, resizing the VM is difficult due to the utmost provide value you set once you created the Spot VM.
The trick is to cease the VM, replace the provide most value, after which resize the VM.
I defined the steps for finishing these duties on this fast information, and I hope you discovered it helpful. Let me know your ideas by responding to our “Was this web page useful?” suggestions request under.
