Change the Size of an Azure VM using PowerShell

This “Change the Size of an Azure VM Using Powershell” IT Pro Challenge virtual lab teaches you how to manipulate VM size in Azure using the PowerShell. You will create and attach a cloud fileshare and work with it via PowerShell commands. By the end of this lab, you will have learned how to manipulate VM size on the Azure cloud.

45 minutes
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *

Already have an account? Sign In »


Azure is a public cloud computing platform. Azure can be used for many purposes, such as analytics, virtual computing, and networking. In particular, Azure provides a powerful tool for hosting virtual machines (VMs). It is therefore prudent for modern IT workers to be comfortable working with Azure.

One key tool that is part of the Azure platform is the Azure PowerShell. The Azure PowerShell is an extension of the Windows PowerShell. Programmers can use scripts, called cmdlets, to automate many of the tasks necessary to manage cloud services. Cmdlets are used to perform many complex tasks, such as provisioning a VM or creating cloud services. This hands-on lab will give you the basic skills you need to work with the Azure PowerShell for your needs.

Understand the scenario: You are a systems administrator for a company that is migrating virtual machines to Azure. After an initial deployment and configuration of virtual machines, your company will use the Azure PowerShell to automatically update the size of VMs to their production requirements. You need to configure Azure Cloud Shell, then use the Cloud Shell to resize the VM.

Understand the environment: You are using an Azure resource group that contains a preconfigured VM named DevSystem1. The configuration of the VM may not be complete when you begin this guided lab. You will receive a notification when the automated configuration is complete.

Configure Azure Cloud Shell for use with PowerShell:

For the first step of this challenge, you will need to configure the Azure Cloud Shell. To do this, you will:

  • Sign in to the Azure portal.
  • Create a file share in the existing storage account with a Quota of 6.
  • Configure the advanced settings and attach the storage.

View available virtual machine sizes in your location:

Next, you will use the Azure portal to learn about available VM sizes. VM sizes vary by location, and you will need to understand how to configure VMs based on your location. In this step, you will use the Azure portal to view the VM service and note its size, location, and resource group. You will then create a variable in the PowerShell to contain information about the VM size.

Change the size of the virtual machine:

In the final step, you will complete the core of this IT challenge. You will use the PowerShell to change the size of the VM. To do this, you will:

  • Use the Get-AzureRMVM cmdlet to create a variable named $VM that stores the VM details.
  • Use the HardwareProfile.VMSize property to assign the value of the $Size variable.
  • Update the virtual machine using the $VM variable.
  • Confirm that the virtual machine has been successfully resized.


After completing the “Change the Size of an Azure VM Using Powershell” challenge, you will accomplished the following:

  • Configured the Azure Cloud Shell for use with PowerShell.
  • Viewed available virtual machine sizes in your location.
  • Changed the size of the VM.
  • Confirmed the new size of the VM.

In the modern IT environment, familiarity with the Azure platform will provide you with a competitive edge. Azure is quickly rising in popularity for many applications. Azure is ideal in many ways, as it lets companies move as much of their business to cloud as their needs dictate. Azure lets its users add cloud capabilities to their existing network and/or move all of their capabilities to Microsoft data centers.

This guided challenge lets you develop skills in using virtual machines and knowledge of state-of-the-art virtualization technologies. The skills you will learn in this hands on lab are important to many work roles, including Enterprise Architects, Network Operations Specialists, and System Administrators. Developing key skills using VMs through the Azure platform will help with many more career paths as well, such as Cyber Defense Forensics Analyst, Cyber Instructor, Law Enforcement/Counterintelligence Forensics Analyst, and Security Control Assessor.

Other Challenges in this series:

  • GUIDED CHALLENGE - Monitor and Resolve Security Issues Using Azure Security Center
  • ADVANCED CHALLENGE - Can You Provision Disk Encryption Using BitLocker and Azure Key Vault