Creating a Tool to keep our Azure Subscription Clean
Summary
In this session, Frank is starting a new project to Automatically delete “expired” resources inside our Azure Subscription. First things to do is to get familiar with the Kusto Query Language (KQL)…
Replay
Segments
- 00:00:01 - Bonjour, Hi!
- 00:01:25 - Recap the project.
- 00:18:28 - Explore the Azure Queries
- 02:21:00 - We have the query and the script
Goals
- List expired resources
- Create an easy way to add tags
- List empty Resource Groupes
- delete expired resources
- Sent notification with list of expired resources
- capture any errors that might happen
Hosting
Streams Notes/ Snipets/ Shared urls
This query return the resources that are expired
-
az graph query -q ‘where todatetime(tags.expireOn) > now() project name, type, expireOn=tostring(tags.expireOn) limit 5’
References
-
GitHub Project: https://github.com/FBoucher/AzurePowerTools
-
https://docs.microsoft.com/en-us/azure/kusto/query/scalar-data-types/datetime