Using an Azure runbook, with a Powershell Workflow, I'm trying to store the VM status into a variable as string. The following works in a Powershell script, but not a Workflow.
$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 as string?
workflow WF1 {
...
$VM = Get-AzureRmVM -ResourceGroupName RG1 -Name VM1 -Status
$VMStatus = $VM.Statuses[1].DisplayStatus
...
}
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;}
Thanks in advance.