Notifing running resources after a period of time

Alex Campos 1 Reputation point
2021-08-26T17:56:05.863+00:00

Hi
Let me share my situation so maybe you can direct me to a better solution.
We had a subscription just for sandbox, so people go there and create Azure resources as they need, however we have noticed that some people forget their resources running after a while and never go back there to delete them. So at the end, we're paying to unused resources on Azure and nobody is taking care of them.
So my idea is, to setup a notification email to the owner of the Azure resource while a period of time automatically. Example: Once a resource is created and aster 30 days, I would get an email notification to remind me that my resource is still running.
How can I accomplish this?

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,263 questions
Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,257 questions
Azure Policy
Azure Policy
An Azure service that is used to implement corporate governance and standards at scale for Azure resources.
887 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. SadiqhAhmed-MSFT 45,181 Reputation points Microsoft Employee
    2021-08-30T19:22:33.667+00:00

    Hello @Alex Campos - Thank you for your post and I apologize for the delayed response!

    You can do this by multiple ways.
    One of the way would be to send the activity logs to Log Analytics workspace and build the activity log query based alert something like this.

    AzureActivity
    | where CategoryValue == "Administrative" and OperationNameValue == "MICROSOFT.RESOURCES/DEPLOYMENTS/WRITE"
    | extend days= datetime_diff('day',now(),TimeGenerated)
    | where days >= 30

    ---------------------------------------------------------------------------------------------------------------

    If the response helped, do "Accept Answer" and up-vote it.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.