Open In App

Microsoft Azure – Get Azure VM Properties using Azure PowerShell

The purpose of using the Azure PowerShell Commands is to quickly analyze the overall properties of VM/VMs at once the filtering the with select and where conditions. To find the properties of an Azure VM, you can perform the following commands in Azure Cloud Shell to get the details. 

Command:



Get-AzVM

Output:



1. Get all properties of an Azure Virtual Machine Server

Use the below command to get all properties of an Azure VM server:

Command:

Get-AzVM -Name "vm_name" -ResourceGroup "resource_group_name"

Example:

Get-AzVM -Name "CloudOpsVM" -ResourceGroup "Cloud-Operations"

Output:

2. Expand the  properties of Azure VM Extensions

Use the below command to expand the complete properties of an Azure VM Extension:

Command:

Get-AzVM -Name "vm_name" -ResourceGroup "resource_group_name" `
| Select -ExpandProperty Extensions

Example:

Get-AzVM -Name "CloudOpsVM" -ResourceGroup "Cloud-Operations" `
| Select -ExpandProperty Extensions

Output:

3. Get the Names of Azure VM Extensions

To get the names of Azure VM extensions, use the below command:

Command:

Get-AzVM -Name "vm_name" -ResourceGroup "resource_group_name" `
| Select -ExpandProperty Extensions `
| Select Name

Example:

Get-AzVM -Name "CloudOpsVM" -ResourceGroup "Cloud-Operations" `
| Select -ExpandProperty Extensions `
| Select Name

Output:

4. Size of an Azure VM 

Use the below command to get the size of an Azure VM:

Command:

Get-AzVM -Name "vm_name" -ResourceGroup "resource_group_name" `
| Select -ExpandProperty HardwareProfile

Example:

Get-AzVM -Name "CloudOpsVM" -ResourceGroup "Cloud-Operations" `
| Select -ExpandProperty HardwareProfile

Output:

Article Tags :