Use PowerShell to Resize an Azure Virtual Machine in an Availability Set

30 minutes
  • 3 Learning Objectives

About this Hands-on Lab

Your company’s finance department explains that the cost of Azure virtual machines (VMs) is over budget. You must find an easy solution to decrease the cost of Azure VMs in your subscription. Using only PowerShell, how do you identify the VMs with low CPU utilization and change their size?

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Start Cloud Shell
  1. Click the Cloud Shell icon (>_) in the upper right.
  2. Select PowerShell.
  3. Click Show advanced settings.
  4. For Storage account, select Create new and give it a globally unique name (e.g., "cloudshell" with a series of numbers at the end).
  5. For File share, select Create new and give it a name of "fileshare".
  6. Click Create storage.
Get the VM Size and CPU Metrics
  1. Find the current size of the VMs.

  2. Get the VM subscription name.

  3. Check VM CPU metrics.

Resize VMs in Availability Set
  1. Check which VMs are available to resize within the VM hardware cluster.

    1. Perform the PowerShell commands to resize the VM(s).

Additional Resources

There are two virtual machines pre-provisioned with this lab. Log in to the Azure portal and discover if these VMs can be resized.

Open Cloud Shell and get to the PowerShell prompt.

Then, view the current VM sizes along with the CPUs consumed.

When you've determined that CPU consumption is low, change the VM to a smaller and cheaper size. This will include checking which VM sizes are available on the hardware cluster where the VM is hosted.

Once you've changed the size of the VM(s), you have completed this lab.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!
Thanks for reaching out!

You’ll hear from us shortly. In the meantime, why not check out what our customers have to say about ACG?