Azure - Orphaned Resources dashboard

 

Introduction

Hello Everyone, 

Back to one more article with Azure Orphaned resources. As we all working in azure and we keep creating the resources as many as want based on the requirement, but sometimes we forget to delete those resources which will cost you without knowing it. This cost may be a smaller but if you calculate it for a year then it'll be a huge. 

So thought of creating the dashboard one, but before i create i wanted to know whether anyone published an article on how to fetch the same. Interestingly, I got lot of quite good articles but the content was same, So i've additionally added few tiles which will address the additional resource types.

I took the developed one from the following site and added additional content. 


Thanks to @Dolev Shor for developing this workbook.


Additionaly, Clone the new tile from the workbook and use the below Resource graph query to create new dashboards.

Snapshots:

resources

where type == 'microsoft.compute/snapshots'

extend TimeCreated = properties.timeCreated

where TimeCreated < ago(30d)

summarize count(type)


VM:


resources

where type == 'microsoft.compute/virtualmachines'

extend vmstatus = properties.extended.instanceView.powerState.displayStatus

where vmstatus != 'VM running'

summarize count(type)


Alerts: 


resources

where type contains 'microsoft.insights/scheduledqueryrules' or type contains 'microsoft.insights/activitylogalerts' or type contains 'microsoft.insights/metricalerts'

extend alertstatus = properties.enabled

where alertstatus == 'false'

summarize count(name)


LB:


resources

where type == "microsoft.network/loadbalancers"

where properties.loadBalancingRules == "[]"

summarize count(type)


Certificate Expiration(Defined 30 days as an example)


resources

where type == 'microsoft.web/certificates'

extend expiry = todatetime(properties.expirationDate)

where expiry between (now().. ago(-30d))

project CertName=properties.subjectName, expiry


Virtual Networks without Subnet


resources
| where type == "microsoft.network/virtualnetworks"
| where properties.subnets == "[]"


Finally, the Dashboards would be like the below one, 






Let me know your comments if any.


Comments

Shoyeb said…
please help me with steps with some screenshots to do the below or as you mentioned at the end of blog.

Clone the new tile from the workbook and use the below Resource graph query to create new dashboards?
I will be thankful to you I did not understand the steps to achieve that but i want learn and understand the same I hope you will help me, thanks in Adv.
Azure Blog said…
Hi Shoyeb,

I'm happy that you've gone through my blog and asked questions. As i mentioned you've to follow the this link(https://github.com/dolevshor/azure-orphan-resources) to import the baseline workbook and then import it using the provided steps. Once you imported click to edit the workbook and clone the tile like below,

Since there is no option to add the images into the reply section, click on the below link to see the images.

Cloning: https://drive.google.com/file/d/17pYl2CiETEzZOdD_YOkHz7-Lgc-Vm5g6/view?usp=sharing
Query Editor: https://drive.google.com/file/d/1whK5XiXOBDLILrd_4GH4WFARLbiZdRS4/view?usp=sharing

Let me know if the above pictures are able to help you out. Thank you!

Regards,
Logan
Anonymous said…
Hello Sir,
Thank you so much for the reply.
i am really very happy and blessed that I got reply I will go through the steps which you have mentioned. I have already copied code from github and implemented but the only which i was unable to achieve addition stuff as below: unable to achieve only addition stuff clone tiles and get additional data like for snapshot e.g.
Additionaly, Clone the new tile from the workbook and use the below Resource graph query to create new dashboards.

I will go through the steps shared by and will share result with you..
Sir you are just awesome. Sorry for late reply.