KenWin0x539
KenWin0x539

Reputation: 339

Powershell - Converting Azure Keyvault Response Data

I am trying to setup a script for setting up my keyvault and deploying my ARM templates. When I create a keyvault I want to take that output and store it into an object, say, $output. The output looks like so

Name  : CertificateThumbprint
Value : xxxxx

Name  : SourceVault
Value : xxxxxxx

Name  : CertificateURL
Value : xxxxxxxxx

I want to convert this to Json (or xml) so that I can access the data and update my template parameters file. However, when I try to ConvertTo-Json or ConvertTo-Xml I get something like

[
    {
        "pageHeaderEntry":  null,
        "pageFooterEntry":  null,
        "autosizeInfo":  null,
        "shapeInfo":  {
                          "ClassId2e4f51ef21dd47e99d3c952918aff9cd":  "..."
                      },
        "groupingEntry":  null,
        "ClassId2e4f51ef21dd47e99d3c952918aff9cd":  "..."
    },
    {
        "shapeInfo":  null,
        "groupingEntry":  null,
        "ClassId2e4f51ef21dd47e99d3c952918aff9cd":  "..."
    },
    {
        "formatEntryInfo":  {
                                "listViewFieldList":  "Microsoft.PowerShell.Commands.Internal.Format.ListViewField Microsoft.PowerShell.Commands.Internal.Format.ListViewField"
...
]

My powershell experience is pretty minimal so I'm not exactly familiar with all the Format options.

Upvotes: 1

Views: 121

Answers (1)

claudekennilol
claudekennilol

Reputation: 1079

$output[2].formatEntryInfo.listViewFieldList...foo...bar 

Should allow you to access your properties of the output without having to convert at all

Upvotes: 1

Related Questions