Get-AzureRmVM
Gets the properties of a virtual machine.
Caution
Because Az PowerShell modules now have all the capabilities of AzureRM PowerShell modules and more, we'll retire AzureRM PowerShell modules on 29 February 2024.
To avoid service interruptions, update your scripts that use AzureRM PowerShell modules to use Az PowerShell modules by 29 February 2024. To automatically update your scripts, follow the quickstart guide.
Syntax
Get-AzureRmVM
[-Status]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzureRmVM
[-ResourceGroupName] <String>
[-Status]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzureRmVM
[-ResourceGroupName] <String>
[-Name] <String>
[-Status]
[-DisplayHint <DisplayHintType>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzureRmVM
-Location <String>
[-Status]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzureRmVM
[-Status]
[-NextLink] <Uri>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
The Get-AzureRmVM cmdlet gets the model view and instance view of an Azure virtual machine. The model view is the user specified properties of the virtual machine. The instance view is the instance level status of the virtual machine. Specify the Status parameter to get only the instance view of a virtual machine.
Examples
Example 1: Get model and instance view properties
PS C:\> Get-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07"
This command gets the model view and instance view properties of the virtual machine named VirtualMachine07.
Example 2: Get instance view properties
PS C:\> Get-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" -Status
This command gets properties of the virtual machine named VirtualMachine07. This command specifies the Status parameter. Therefore, the command gets only the instance view properties.
Example 3: Get properties for all virtual machines in a resource group
PS C:\> Get-AzureRmVM -ResourceGroupName "ResourceGroup11"
This command gets properties for all the virtual machines in the resource group named ResourceGroup11.
Example 4: Get all virtual machines in your subscription
PS C:\> Get-AzureRmVM
This command gets all the virtual machines in your subscription.
Example 5: Get all virtual machines in the location.
PS C:\> Get-AzureRmVM -Location "westus"
This command gets all the virtual machines in West US region.
Parameters
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure.
Type: | IAzureContextContainer |
Aliases: | AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DisplayHint
Determines how the virtual machine object is displayed. Valid values are: -- Compact: displays only top level properties -- Expand: displays all properties in all levels
Type: | DisplayHintType |
Accepted values: | Compact, Expand |
Position: | Named |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Location
Specifies a location for the virtual machines to list.
Type: | String |
Position: | Named |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Name
Specifies the name of the virtual machine to get.
Type: | String |
Aliases: | ResourceName, VMName |
Position: | 1 |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-NextLink
Specifies the next link.
Type: | Uri |
Position: | 1 |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ResourceGroupName
Specifies the name of a resource group.
Type: | String |
Position: | 0 |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Status
Indicates that this cmdlet gets only the instance view of the virtual machine.
Type: | SwitchParameter |
Position: | 2 |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |