Get-AzVM
Gets the properties of a virtual machine.
Get-AzVM
[[-ResourceGroupName] <String>]
[[-Name] <String>]
[-Status]
[-UserData]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzVM
[-ResourceGroupName] <String>
[-Name] <String>
[-Status]
[-DisplayHint <DisplayHintType>]
[-UserData]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzVM
-Location <String>
[-Status]
[-UserData]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzVM
[-Status]
-ResourceId <String>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
The Get-AzVM cmdlet gets the model view or the 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 the instance view of a virtual machine instead of the model view which is the default.
Get-AzVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07"
ResourceGroupName : ResourceGroup11
Id : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ResourceGroup11/providers/M
icrosoft.Compute/virtualMachines/VirtualMachine07
VmId : 00000000-0000-0000-0000-000000000000
Name : VirtualMachine07
Type : Microsoft.Compute/virtualMachines
Location : eastus
Tags : {"creationSource":"acs-VirtualMachine07"}
AvailabilitySetReference : {Id}
DiagnosticsProfile : {BootDiagnostics}
Extensions : {linuxdiagnostic, waitforleader}
HardwareProfile : {VmSize}
NetworkProfile : {NetworkInterfaces}
OSProfile : {ComputerName, AdminUsername, LinuxConfiguration, Secrets}
ProvisioningState : Succeeded
StorageProfile : {ImageReference, OsDisk, DataDisks}
This command gets the model view and instance view properties of the virtual machine named VirtualMachine07.
Get-AzVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" -Status
ResourceGroupName : ResourceGroup11
Name : VirtualMachine07
Disks[0] :
Name : VirtualMachine07-osdisk
Statuses[0] :
Code : ProvisioningState/succeeded
Level : Info
DisplayStatus : Provisioning succeeded
Time : 3/1/2019 12:59:30 AM
Extensions[0] :
Name : linuxdiagnostic
Type : Microsoft.OSTCExtensions.LinuxDiagnostic
TypeHandlerVersion : 2.3.9029
Statuses[0] :
Code : ProvisioningState/succeeded
Level : Info
DisplayStatus : Provisioning succeeded
Message : Invalid config settings given: Empty storageAccountName. Install will proceed, but enable
can't proceed, in which case it's still considered a success as it's an external error.
Extensions[1] :
Name : waitforleader
Type : Microsoft.OSTCExtensions.CustomScriptForLinux
TypeHandlerVersion : 1.5.4
Statuses[0] :
Code : ProvisioningState/succeeded
Level : Info
DisplayStatus : Provisioning succeeded
Message : Command is finished.
---stdout---
waiting for leader.mesos
waiting for leader.mesos
waiting for leader.mesos
waiting for leader.mesos
waiting for leader.mesos
waiting for leader.mesos
PING leader.mesos (xxx.xx.x.x) 56(84) bytes of data.
64 bytes from xxx.xx.x.x: icmp_seq=1 ttl=64 time=0.022 ms
--- leader.mesos ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.022/0.022/0.022/0.000 ms
leader.mesos up
---errout---
ping: unknown host leader.mesos
ping: unknown host leader.mesos
ping: unknown host leader.mesos
ping: unknown host leader.mesos
ping: unknown host leader.mesos
ping: unknown host leader.mesos
PlatformFaultDomain : 0
PlatformUpdateDomain : 0
VMAgent :
VmAgentVersion : 2.2.37
ExtensionHandlers[0] :
Type : Microsoft.OSTCExtensions.LinuxDiagnostic
TypeHandlerVersion : 2.3.9029
Status :
Code : ProvisioningState/succeeded
Level : Info
DisplayStatus : Ready
Message : Plugin enabled
ExtensionHandlers[1] :
Type : Microsoft.OSTCExtensions.CustomScriptForLinux
TypeHandlerVersion : 1.5.4
Status :
Code : ProvisioningState/succeeded
Level : Info
DisplayStatus : Ready
Message : Plugin enabled
Statuses[0] :
Code : ProvisioningState/succeeded
Level : Info
DisplayStatus : Ready
Message : Guest Agent is running
Time : 3/1/2019 2:04:12 AM
Statuses[0] :
Code : ProvisioningState/succeeded
Level : Info
DisplayStatus : Provisioning succeeded
Time : 3/1/2019 1:01:57 AM
Statuses[1] :
Code : PowerState/running
Level : Info
DisplayStatus : VM running
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.
Get-AzVM -ResourceGroupName "ResourceGroup11"
ResourceGroupName Name Location VmSize OsType NIC
----------------- ---- -------- ------ ------ ---
ResourceGroup11 test1 eastus Standard_DS1_v2 Windows test1
ResourceGroup11 test2 westus Standard_DS1_v2 Windows test2
ResourceGroup11 test3 eastus Standard_DS1_v2 Windows test3
This command gets properties for all the virtual machines in the resource group named ResourceGroup11.
Get-AzVM
ResourceGroupName Name Location VmSize OsType NIC
----------------- ---- -------- ------ ------ ---
TEST1 test1 eastus Standard_DS1_v2 Windows test1
TEST1 test2 westus Standard_DS1_v2 Windows test2
TEST1 test3 eastus Standard_DS1_v2 Windows test3
TEST2 test4 westus Standard_DS1_v2 Windows test4
TEST2 test5 eastus Standard_DS1_v2 Windows test5
This command gets all the virtual machines in your subscription.
Get-AzVM -Location "westus"
ResourceGroupName Name Location VmSize OsType NIC
----------------- ---- -------- ------ ------ ---
TEST1 test2 westus Standard_DS1_v2 Windows test2
TEST2 test4 westus Standard_DS1_v2 Windows test4
This command gets all the virtual machines in West US region.
Get-AzVM -Name test*
ResourceGroupName Name Location VmSize OsType NIC
----------------- ---- -------- ------ ------ ---
TEST1 test1 eastus Standard_DS1_v2 Windows test1
TEST1 test2 westus Standard_DS1_v2 Windows test2
TEST1 test3 eastus Standard_DS1_v2 Windows test3
TEST2 test4 westus Standard_DS1_v2 Windows test4
TEST2 test5 eastus Standard_DS1_v2 Windows test5
This command gets all virtual machines with names start with "test"
Get-AzVM -ResourceGroupName <Resource Group Name> -Name <VM Name> -UserData;
ResourceGroupName : <>
Id : /subscriptions/<Subscription Id>/resourceGroups/<Resource Group Name>/providers/Microsoft
.Compute/virtualMachines/<VM Name>
VmId : <VM Id>
Name : <VM Name>
Type : Microsoft.Compute/virtualMachines
Location : eastus
Tags :
{"azsecpack":"nonprod","platformsettings.host_environment.service.platform_optedin_for_rootcerts":"true"}
Extensions : {Microsoft.Azure.Geneva.GenevaMonitoring,
Microsoft.Azure.Security.AntimalwareSignature.AntimalwareConfiguration}
HardwareProfile : {VmSize}
NetworkProfile : {NetworkInterfaces}
OSProfile : {ComputerName, AdminUsername, WindowsConfiguration, Secrets, AllowExtensionOperations,
RequireGuestProvisionSignal}
ProvisioningState : Succeeded
StorageProfile : {ImageReference, OsDisk, DataDisks}
UserData : bm90IGVuY29kZWQ=
The UserData value must always be Base64 encoded. This command assumes you have already created a VM with a UserData value.
The credentials, account, tenant, and subscription used for communication with azure.
Type: | IAzureContextContainer |
Aliases: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
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 |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Specifies a location for the virtual machines to list.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Specifies the name of the virtual machine to get.
Type: | String |
Aliases: | ResourceName, VMName |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | True |
Specifies the name of a resource group.
Type: | String |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | True |
Id of the VM
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Indicates that this cmdlet gets only the instance view of the virtual machine.
Type: | SwitchParameter |
Position: | 2 |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
UserData for the VM, which will be base-64 encoded. Customer should not pass any secrets in here.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Azure PowerShell feedback
Azure PowerShell is an open source project. Select a link to provide feedback: