Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi All,
After much research and trial and error I am trying to figure out a way to parse the Azure resource tags that are exported using the Azure Enterprise connector and use them against other metrics for cost analysis etc. I know you can split the column "Tags" based on a delimiter and assuming the correct tags are applied in the same order for each resource in to separate column's but in our environment the number of tags applied could vary. Below is an example of how the tags are displayed in the exported table.
{"Hostname":"TestSvr01","Location":"Sydney","Project":"12345","Workload":"TestApp1","Workorder":"1234"}
What I am trying to achieve is a script or a query which would search for a key word in the Tags column and then place that value into a separate column e.g. Search for the keyword Hostname and place the value next to it in a new column called hostnames. Because a resource/VM could have multiple "Workload" tags I need a method to parse the string instead of using straight delimiters to column process.
Any help with this would be very much appreciated and please ask me to clarify if anything is unclear.
On a side note I am very surprised that MS make reporting on resource tags so difficult.
Thanks
Danny
Solved! Go to Solution.
That looks like a valid JSON string. Try to add a custom column with Json.Document and expand the column accordingly.
let Source = Table.FromRows({{1,"{""Hostname"":""TestSvr01"",""Location"":""Sydney"",""Project"":""12345"",""Workload"":""TestApp1"",""Workorder"":""1234""} "},{2,"{""Hostname"":""TestSvr02"",""Location"":""NewYork"",""Project"":""12345"",""Workload"":""TestApp1"",""Workorder"":""1234""} "}},{"id","tags"}), #"Added Custom" = Table.AddColumn(Source, "Custom", each Json.Document([tags])), #"Expanded Custom" = Table.ExpandRecordColumn(#"Added Custom", "Custom", {"Hostname", "Location", "Project", "Workload", "Workorder"}, {"Custom.Hostname", "Custom.Location", "Custom.Project", "Custom.Workload", "Custom.Workorder"}) in #"Expanded Custom"
That looks like a valid JSON string. Try to add a custom column with Json.Document and expand the column accordingly.
let Source = Table.FromRows({{1,"{""Hostname"":""TestSvr01"",""Location"":""Sydney"",""Project"":""12345"",""Workload"":""TestApp1"",""Workorder"":""1234""} "},{2,"{""Hostname"":""TestSvr02"",""Location"":""NewYork"",""Project"":""12345"",""Workload"":""TestApp1"",""Workorder"":""1234""} "}},{"id","tags"}), #"Added Custom" = Table.AddColumn(Source, "Custom", each Json.Document([tags])), #"Expanded Custom" = Table.ExpandRecordColumn(#"Added Custom", "Custom", {"Hostname", "Location", "Project", "Workload", "Workorder"}, {"Custom.Hostname", "Custom.Location", "Custom.Project", "Custom.Workload", "Custom.Workorder"}) in #"Expanded Custom"
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
115 | |
100 | |
88 | |
69 | |
61 |
User | Count |
---|---|
151 | |
120 | |
103 | |
87 | |
68 |