Syntax
| Parameter | Description | 
|---|---|
| -Name<String> | Specifies the name of the virtual machine. | 
| -ResourceGroupName<String> | Specifies the name of the resource group. | 
| -Status | Retrieves the status of the virtual machine. | 
| -InstanceView | Retrieves the instance view of the virtual machine. | 
| -DefaultProfile<IAzureContextContainer> | The credentials, account, tenant, and subscription that are used for communication with Azure. | 
| -Confirm | Prompts you for confirmation before running the cmdlet. | 
| -WhatIf | Shows what would happen if the cmdlet runs. The cmdlet is not run. | 
Description
The Get-AzVM cmdlet retrieves information about virtual machines in Azure.
You can use this cmdlet to retrieve a specific virtual machine or all virtual machines in a resource group or subscription.
Examples
Example 1: Get all virtual machines in a resource group
Get-AzVM -ResourceGroupName "ResourceGroup11"Example 2: Get a specific virtual machine
Get-AzVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07"Example 3: Get the status of a virtual machine
Get-AzVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" -StatusExample 4: Get the instance view of a virtual machine
Get-AzVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" -InstanceViewParameters
| Parameter | Type | Description | Required | 
|---|---|---|---|
| -Name | String | Specifies the name of the virtual machine. | No | 
| -ResourceGroupName | String | Specifies the name of the resource group. | No | 
| -Status | Switch | Retrieves the status of the virtual machine. | No | 
| -InstanceView | Switch | Retrieves the instance view of the virtual machine. | No | 
| -DefaultProfile | IAzureContextContainer | The credentials, account, tenant, and subscription that are used for communication with Azure. | No | 
| -Confirm | Switch | Prompts you for confirmation before running the cmdlet. | No | 
| -WhatIf | Switch | Shows what would happen if the cmdlet runs. The cmdlet is not run. | No |