Search unused resource using resource-graph-explorer

Today, i post about search unused resource using resource-graph-explorer & dashboard

You move to ‘Resource-Graph-Explorer’ in Azure Portal.
And then you can query anything.

First, you query this command. it’s same query under the picture.

disabled nic Accelerate

1
2
3
Resources
| where type == "microsoft.network/networkinterfaces" and properties ["enableAcceleratedNetworking"] == "false"
| project resourceGroup, name

note: i capture without |project resourceGroup, name

And you can save query. Click save as button.
Type the name appropriate about query function.
You can choice type private, public. this time, i saved private

Then, you find query name changed.
And we pin to dashboard this query. Click the button pin to dashboard

Create new dashboard with private. then Click create button

It’s working good. then i added additional query in dashboard.

*no associated Nic

1
2
3
Resources
| where type == "microsoft.network/networkinterfaces" and isnull(properties.virtualMachine)
| project resourceGroup, name

no custom dns settings

1
2
3
Resources
| where type == "microsoft.network/networkinterfaces" and array_length(properties.dnsSettings.appliedDnsServers) == 0
| project resourceGroup, name

no attached managed disks

1
2
3
Resources
| where type == "microsoft.compute/disks" and isempty(managedBy)
| project resourceGroup, name

no assocated nsg

1
2
3
4
Resources
| where type == "microsoft.network/networksecuritygroups" and isnull(properties.networkInterfaces)
and isnull(properties.subnets)
| project resourceGroup, name

no associated pip

1
2
3
4
Resources
| where type == "microsoft.network/publicipaddresses"
| where isnull(properties.ipConfiguration) or isempty(properties.ipConfiguration)
| project resourceGroup, name

Then, i added all query to dashboard.
It’s good job!

Share