Alert for Azure Policy Definition and Assignment Changes

Yasmin, Fitri 266 Reputation points
2021-03-01T14:43:57.047+00:00

I have an assigned policy in my subscription with Deny mode. However, somebody in my team keep changing this back to Audit. In another instance, my azure policy definition is also changed. Is there a way I can see who changed my policy definition and assignment? How to create alerts for these type of changes?

Azure Policy
Azure Policy
An Azure service that is used to implement corporate governance and standards at scale for Azure resources.
797 questions
{count} votes

Accepted answer
  1. tbgangav-MSFT 10,386 Reputation points
    2021-03-03T13:11:17.733+00:00

    Hi anonymous user,

    Yes, there is a way to see who has changed a policy definition or assignment with the help of Activity logs. Below are the actions under which such changes are logged.

    • Action for change in policy definition - Microsoft.Authorization/policyDefinitions/write
    • Action for change in policy assignment - Microsoft.Authorization/policyAssignments/write

    73728-image.png

    73700-image.png

    73821-image.png

    For testing purpose, I have changed the names of both definition and assignment and could see those changes being tracked under activity log's properties.requestbody attribute.

    You can create alerts by sending activity logs to Log Analytics workspace in two ways i.e., via Activity logs diagnostics settings or via legacy method and then you can configure log alert with the help of AzureActivity table.

    Activity logs diagnostics settings way:
    73778-image.png

    73806-image.png

    73757-image.png

    Legacy way:
    73758-image.png

    Sample kusto query using AzureActivity table to just fetch policy definition write operations for a particular policy definition and done by a particular caller:
    73798-image.png

    Related reference:
    Azure resource provider operations


0 additional answers

Sort by: Most helpful