So I have this array of informations I gather from my azure subscription that is converted from json:
$Request += (((az consumption usage list --subscription $subscriptionID --start-date $CycleStart --end-date $CycleEnd) 2> $null | ConvertFrom-Json) | select subscriptionname, instanceName, usageStart, usageEnd, pretaxCost, tags )
That produce an array that looks ok :
$Request
subscriptionName : Sub1
instanceName : VM1
usageStart : 2020-01-27T00:00:00Z
usageEnd : 2020-01-27T23:59:59Z
pretaxCost : 3.194
tags : @{Classification=ABC, Zone=123, Field=qaz, Org=CAL, Owner=Bob@dev}
subscriptionName : Sub1
instanceName : VM2
usageStart : 2020-01-27T00:00:00Z
usageEnd : 2020-01-27T23:59:59Z
pretaxCost : 2.1
tags : @{Classification=zzz, Zone=123, Field=qaz, Org=NZ, Owner=John@prod}
But as you see, the field “tags” looks merged between @{xxxx}. What I would like to acheive and couldn’t after hours of trial&error (!) is something like that :
subscriptionName : Sub1 instanceName : VM1 usageStart : 2020-01-27T00:00:00Z usageEnd : 2020-01-27T23:59:59Z pretaxCost : 3.194 Classification : ABC Zone : 123 Field : qaz Org : CAL Owner : Bob@dev subscriptionName : Sub1 instanceName : VM2 usageStart : 2020-01-27T00:00:00Z usageEnd : 2020-01-27T23:59:59Z pretaxCost : 2.1 Classification : ABC Zone : 222 Field : BIZ Org : NZ Owner : John@dev
But… the field nested under “tags” can change over the time so I can’t hardcode something that will look for “Classification”, “Zone”, “Field”, etc…)
Can anyone help me with this one ? ![]()