Azure and PowerShell: getting the status of the VM

If you run this, then you get a bunch of information… but not the key points about provisioning status:

AzureStatus01

$vmStatus = Get-AzureRmVM | Where-Object { $_.Name -eq "myvm1"} 
$vmStatus.OperationStatus 
$vmStatus 
Write-Host $vmStatus.DataDiskNames 
Write-Host $vmStatus.DiagnosticsProfile 
Write-Host $vmStatus.HardwareProfile 
Write-Host $vmStatus.HardwareProfile.VmSize 
Write-Host $vmStatus.StatusCode 
Write-Host $vmStatus.ResourceGroupName 
Write-Host $vmStatus.Location 
Write-Host $vmStatus.HardwareProfile.VmSize 
Write-Host $vmStatus.StorageProfile.ImageReference.Sku 
Write-Host $vmStatus.StorageProfile.OsDisk.OsType 
Write-Host $vmStatus.StorageProfile.OsDisk.Name 
Write-Host $vmStatus.StorageProfile.OsDisk.Vhd.Uri

So the same command, but now specifying the resource name and vm name as arguments, gives this:

$vmStatus = Get-AzureRmVM -ResourceGroupName $rgName -Name $vmName -Status

AzureStatus02

And from there, we can drill in. For example:

AzureStatus03

That was a VM that is deallocated. This is how a running VM looks:

AzureStatus04

AzureStatus05

AzureStatus06

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s