Summary

In this session, Frank is creating an Azure Automation for one of the Azure Power Tool. The one that automatically deletes “expired” resources inside our Azure Subscription. Once fully created and functional, he will export the ARM template to look at what kind of resources he will need in the deployment of that solution.

Replay

Segments

  • 00:00:01 - Bonjour, Hi!
  • 00:00:44 - Recap the project.
  • 00:09:42 - Create the Automation RunBook.
  • 01:30:36 - Add code in the script to delete empty Resources Group
  • 01:48:17 - Export ARM Template

Goals

  • List expired resources
  • List empty Resource Groupes
  • delete expired resources
  • Sent notification with list of expired resources
  • capture any errors that might happen

ToDos

  • Create an easy way to add tags
  • Create an ARM template to deploy
  • Clean-up/Structure the GitHub to make sens of the 3 “tools”

New Subscribers

Cheers

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’
  • We need to add module
    • Az.Accounts
    • Az.ResourceGraph

References

  • GitHub Project: https://github.com/FBoucher/AzurePowerTools

  • https://docs.microsoft.com/en-us/azure/kusto/query/scalar-data-types/datetime