- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to resize the Azure VM using Azure CLI in PowerShell?
To resize the Azure VM using az CLI, we can use “az vm resize” command. Before running this command, make sure you are connected to the Azure cloud and the proper Azure subscription.
To get the current size of the VM,
PS C:\> az vm show -n Win2k16VM1 -g testvmrg --query 'hardwareProfile.vmSize'
Output
"Standard_B2ms"
Here, -n is the VM name, and -g is the resource group name.
To get the VM location,
PS C:\> az vm show -n Win2k16VM1 -g testvmrg --query 'location'
Output
"eastus"
We will now get all the sizes available at the particular location so that we can resize the VM from the sizes listed.
PS C:\> az vm list-sizes -l eastus -otable
Output
To resize the VM with Standard_B2s size.
PS C:\> az vm resize -n Win2k16VM1 -g testvmrg --size Standard_B2s
When we check the size again,
PS C:\> az vm show -n Win2k16VM1 -g testvmrg --query 'hardwareProfile.vmSize'
Output
- Related Articles
- How to deallocate the Azure VM using Azure CLI in PowerShell?
- How to start the Azure VM using Azure CLI in PowerShell?
- How to stop the Azure VM using Azure CLI in PowerShell?
- How to restart the Azure VM using Azure CLI in PowerShell?
- How to get the Azure VM Size using Azure CLI in PowerShell?
- How to get the Azure VM username using Azure CLI in PowerShell?
- How to list the azure VM extensions using Azure CLI in PowerShell?
- How to retrieve the Azure VM nic name using Azure CLI in PowerShell?
- How to get the available azure VM size using Azure CLI in PowerShell?
- How to open port for the Azure VM using Azure CLI in PowerShell?
- How to get the location of the Azure VM using Azure CLI in PowerShell?
- How to retrieve the OS of the Azure VM using Azure CLI in PowerShell?
- How to get all the available azure VM images using Azure CLI in PowerShell?
- How to list the Azure VMs using Azure CLI in PowerShell?
- How to connect to the Azure subscription using Azure CLI in PowerShell?

Advertisements