ARM equivalent of InstanceStatus


  • Hi All

    With VMs created under ASM I used to use Get-AzureVM and then do something like this to determine if they were not in the StoppedDeallocated state:


    With VMs created under ARM and using the new cmdlets (ie Get-AzureRmVM) this doesn't work. Any ideas what the equivalent is please? Thanks!

    Cheers - Graham

    Blog:   LinkedIn:

    Wednesday, November 25, 2015 11:28 PM

All replies

  • Things changed a bit but you can do it like the following :

    $VM = get-azurevm -ResourceGroupName 'RGName' -Name 'VMName' -Status


    and more granular


    Regards, Samir Farhat || Datacenter Consultant || The way to share my knowledge with the community Visit my blog : </a>

    Thursday, November 26, 2015 10:25 AM
  • Hi Samir

    Thanks for that. I had seen the Statuses property however it was returning null. Your code works fine though and the reason mine doesn't is because I'm using a Get-AzureRmVM | ForEach-Object construct so I can find the status of each VM in turn. However the -Status switch that is needed to ensure the Statuses property isn't null also needs the -Name and -ResourceGroupName switches which don't of course make sense when I am wanting to pipe all VMs to ForEach-Object.

    Any thoughts on how to get round this?

    Cheers - Graham

    Blog:   LinkedIn:

    Saturday, November 28, 2015 3:09 PM