How to manually trigger an Azure Policy Evaluation Cycle
Azure Policy is a comprehensive tool to control and govern your azure environments. Whether you want to audit or prevent things from happening in your azure subscriptions, there are plenty of built-in policies you can customize according to your needs. Now I often get the question when and where policies get evaluated once created.
Once a policy or policy initiative has been assigned to a scope (Management Group, Subscription or Resource Group), it usually takes up to 30 minutes to take effect. The policy then evaluates compliance state against all underlying resources (for policies with audit effect). Same applies for changes to existing policy assignments.
While policy effect “deny” prevents affected deployments at submission time on ARM level, recurring policy evaluation against compliance state occurs then every 24 hours.
If you want to initiate a manual instant policy evaluation cycle, you can leverage the ARM REST APIs. Here’s an example to trigger an evaluation cycle on subscription level.
And a similar example to trigger the eval cycle on a specific resource group.