0

Using an Azure runbook, with a Powershell Workflow, I'm trying to store the VM status into a variable. Normally, the following would work.

$VM = Get-AzureRmVM -ResourceGroupName RG1 -Name VM1 -Status
$VMStatus = $VM.Statuses[1].DisplayStatus

The problem is that the workflow in Azure returns Deserialized XML, or more specifically 'Deserialized.Microsoft.Azure.Commands.Compute.Models.PSVirtualMachineInstanceView'.

How can I convert this and store it into a variable?

workflow GB_RB_WF_1
{
...
$VM = Get-AzureRmVM -ResourceGroupName RG1 -Name VM1 -Status
$VMStatus = $VM.Statuses[1].DisplayStatus
...
}

Thanks for any help.

Get-Member output of the relevant section.

PSComputerName        : localhost
PSSourceJobInstanceId : xxx
TypeName              : Deserialized.Microsoft.Azure.Commands.Compute.Models.PSVirtualMachineInstanceView
Name                  : Statuses
MemberType            : Property
Definition            : Deserialized.System.Collections.Generic.List`1[[Microsoft.Azure.Management.Compute.Models.Instan
                        ceViewStatus, Microsoft.Azure.Management.Compute, Version=10.0.0.0, Culture=neutral, 
                        PublicKeyToken=31bf3856ad364e35]] {get;set;}
warnox
  • 33
  • 8

0 Answers0