locked
Deserialized XML to Variable (Azure Workflow Runbook) RRS feed

  • Question

  • 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.
    Tuesday, April 24, 2018 11:43 AM

All replies

  • There is no XML in this process.


    \_(ツ)_/

    Tuesday, April 24, 2018 12:30 PM