Cmdlet name: Get-AzVM
Module: Az.Compute
Synopsis: Gets one or more virtual machines.
Description: The Get-AzVM cmdlet gets virtual machines in Azure. You can get a specific virtual machine by name or the virtual machines in a resource group. You can also get all virtual machines in a subscription.
Gets one or more virtual machines.
Get-AzVM
    [-Name ]
    [-ResourceGroupName ]
    [-Status]
    [-VMId ]
    [-DefaultProfile ]
    []     The Get-AzVM cmdlet gets virtual machines in Azure. You can get a specific virtual machine by name or the virtual machines in a resource group. You can also get all virtual machines in a subscription.
| Name | Type | Description | 
|---|---|---|
| -Name | System.String | Specifies the name of the virtual machine that this cmdlet gets. | 
| -ResourceGroupName | System.String | Specifies the name of the resource group that contains the virtual machine. | 
| -Status | System.Management.Automation.SwitchParameter | Gets the status of the virtual machine. | 
| -VMId | System.String | Specifies the ID of the virtual machine. | 
| -DefaultProfile | Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureContextContainer | The credentials, account, tenant, and subscription for the cloud service. By default, this cmdlet uses the authenticated session that is established by the Set-AzContext cmdlet. | 
| -CommonParameters | System.Management.Automation.CommonParameters | This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, OutVariable. To get the list of the parameters, type Get-Help commonparameter. | 
This command gets all virtual machines in the specified resource group.
Get-AzVM -ResourceGroupName "RG01"This command gets the virtual machine named "MyVM" in the specified resource group.
Get-AzVM -ResourceGroupName "RG01" -Name "MyVM"This command gets all virtual machines in the current subscription.
Get-AzVMThis command gets the virtual machine named "MyVM" and displays its current status.
Get-AzVM -ResourceGroupName "RG01" -Name "MyVM" -StatusMicrosoft.Azure.Commands.Compute.Models.PSVirtualMachine
You can pipe a virtual machine object to the Get-AzVM cmdlet.
Microsoft.Azure.Commands.Compute.Models.PSVirtualMachine
The Get-AzVM cmdlet returns objects that represent virtual machines.