Jul 26 2021
07:43 AM
- last edited on
Apr 08 2022
10:51 AM
by
TechCommunityAP
Jul 26 2021
07:43 AM
- last edited on
Apr 08 2022
10:51 AM
by
TechCommunityAP
I am trying to use Azure Resource Graph to get 3 columns of data:
resources
Jul 27 2021 02:23 AM
One way to do this is to use a join
// get the Total count, store it and create a column to join on
resources
| where type == "microsoft.hybridcompute/machines"
| summarize Total_ = dcount(name), fake_join = "join_"
// Join data on the fake column name = left
| join //right
(
resources
| where type == "microsoft.hybridcompute/machines"
| extend Domain=properties.domainName,ArcMachines=name
| summarize MachinesByDomain=count(ArcMachines) by tostring(Domain), ArcMachines, fake_join ="join_"
) on fake_join
// now calculate the Total from left with the data from the right
| summarize MachinesByDomain=count(ArcMachines), Percentage = ( toreal(sum(MachinesByDomain)) / toreal(max(Total_)) * 100 ) by tostring(Domain)
| order by MachinesByDomain desc