- 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 change the size of the Azure VM using PowerShell?
First, to retrieve the size of the Azure VM that is currently applied, we can use the below command.
PS C:\> $vm = Get-AzVM -VMName VMName PS C:\> $vm.HardwareProfile.VmSize
Output
Standard_B1ms
Now to get the size of the Azure VMs available in the particular location we can use the below command.
PS C:\> Get-AzVMSize -VMName $vm.Name -ResourceGroupName $vm.ResourceGroupName
You will get all the available sizes for Azure VM.
Now we need to set the VM size. Here we will first set the size of the VM and then we will update the virtual machine to take the updated size.
PS C:\> $vm.HardwareProfile.VmSize = 'Standard_B2ms' PS C:\> Update-AzVM -VM $vm -ResourceGroupName $vm.ResourceGroupName - Verbose
We are changing the size of the VM from the Standard_B1ms to Standard_B2ms.
Output
VERBOSE: Performing the operation "Update" on target "Win2k16VM1". RequestId IsSuccessStatusCode StatusCode ReasonPhrase --------- ------------------- ---------- ------------ True OK OK
Once we check the hardware size, it should be updated.
PS C:\> (Get-AzVM -VMName vmname).HardwareProfile.VmSize Standard_B2ms
- Related Articles
- How to get the Azure VM Size using Azure CLI in PowerShell?
- How to get the available azure VM size using Azure CLI in PowerShell?
- How to retrieve the Azure VM RAM and CPU size using PowerShell?
- 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 resize the Azure VM using Azure CLI in PowerShell?
- How to add the tag of Azure VM using PowerShell?
- How to Export the azure VM tags using 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 the Azure VM username using Azure CLI in PowerShell?
- How to list the azure VM extensions using Azure CLI in PowerShell?
- How to delete the specific tag of Azure VM using PowerShell?

Advertisements