# How to retrieve Azure VMs using PowerShell?

PowerShellMicrosoft TechnologiesSoftware & Coding

To retrieve the azure VMs using PowerShell, we can use Get-AzVM commands but before that make sure you logged in using Azure Credentials in the console. When you type this command, you will get the list of all VMs in the specified subscription.

To check which all properties are supported you can use the

Get-AzVM | gm -MemberType Properties

You can select different properties from there using the Select-Object command (Alias: Select). To retrieve the VMs from the specific ResourceGroup, use the below command.

Get-AzVM -ResourceGroupName AUTOMATIONTESTRG2

If your VM is in a different subscription then you need to switch the subscription and need to retrieve the VM list.

Published on 04-Jan-2021 09:48:55