Azure policy changes

Viewed 12

Is there a way (CLI/Query/Powershell command) to find out the recent changes that happened in Azure policy? policy changes happen frequently and many time this impact my resources so wanted to check if there is the way I can quickly see if was there any change in the policy before to I began debugging

Thanks -SS

1 Answers

Via PowerShell you can use Get-AzLog https://learn.microsoft.com/en-us/azure/role-based-access-control/change-history-report

With this command, you can see all logs about Policy definition in the last 7 days

Get-AzLog -StartTime (Get-Date).AddDays(-7) | Where-Object {$_.Authorization.Action -like 'Microsoft.Authorization/policyDefinitions/*'}

With this command, you can see all logs about Policy assignments in the last 7 days

Get-AzLog -StartTime (Get-Date).AddDays(-7) | Where-Object {$_.Authorization.Action -like 'Microsoft.Authorization/policyAssignments/*'}

Hope this helps!

Related