Azure Policy is a powerful tool for enforcing governance and compliance in Azure environments, but users often encounter issues that can hinder its effectiveness. Below is a concise overview of common Azure Policy issues and their troubleshooting steps, based on current information and best practices:
1. Policy Not Firing or Evaluating as Expected
Issue:
Policies fail to trigger or resources are not evaluated correctly (e.g., marked compliant when non-compliant or vice versa).
Causes:
- Incorrect policy mode (e.g., default indexed mode in Azure CLI doesn’t evaluate resource groups).
- Misconfigured policy rule logic or incorrect use of aliases.
- Scope mismatch (e.g., policy assigned to a resource group but not evaluated due to mode restrictions).
Solutions:
- Explicitly set the policy mode to All when using Azure CLI (--mode All) to evaluate resource groups and subscriptions.
- Validate policy rules using the Azure Policy extension for Visual Studio Code or SDK to ensure correct aliases and logic.
- Test policy rules with different combinations of if/then blocks and conditions (All/Any). Reverse the logic if compliance reports are incorrect.
- Ensure the policy scope aligns with the resources being evaluated (e.g., management group, subscription, or resource group).
2.Resource Creation or Update Denied
Issue: Users receive a "Blocked by policy" error when creating or updating resources.
Causes:
- A policy with a Deny effect is applied to the resource scope, blocking non-compliant actions.
- Missing or incorrect resource payload matches the policy logic.
Solutions:
- Check the error message for policy definition and assignment IDs or review the Activity log for details.
- Verify the resource payload using an HTTP Archive (HAR) trace or Azure Resource Manager (ARM) template properties.
- Adjust the policy definition to allow the action or create an exemption for specific resources if justified (e.g., temporary waiver or mitigated exemption).
- Test actions in a non-production environment to identify policy violations before production deployment.
3. Non-Compliance Reporting Issues
Issue:
Resources appear in unexpected compliance states (e.g., not compliant when they should be, or compliance details not updating).
Causes:
- Delay in policy evaluation (new assignments take ~5 minutes, resource updates ~15 minutes, standard scans every 24 hours).
- Incorrect or missing aliases in the policy definition.
- Lack of read permissions for the resource type, preventing compliance data visibility.
Solutions:
- Wait for the evaluation cycle to complete or trigger an on-demand scan using Azure PowerShell, REST API, or Azure Policy Compliance Scan GitHub Action.
- Validate aliases using the Azure Policy extension for VS Code or SDK. If an alias doesn’t exist, create a support ticket.
- Ensure the user has read permissions for the resource type (e.g., Microsoft.DBforPostgreSQL/ flexibleServers /read). Request read operation support if unavailable.
- Review compliance DETAILS pane in the Azure portal for specific non-compliance reasons and check the last 14 days of change history (preview feature) for resource changes.
4. Custom Policy Development Challenges
Issue:
- Custom policies fail to work as intended or produce errors during creation.
Causes:
- Incorrect policy alias or resource type in the definition.
- Policy effects (e.g., Deny) are not supported for the resource type, leading to unexpected behavior.
- Security restrictions prevent certain aliases from being added.
Solutions:
- Use the Azure Policy extension for VS Code to validate aliases and check available operations via Azure RBAC documentation.
- Switch to a supported effect (e.g., Audit instead of Deny) if the resource type doesn’t support the intended effect.
- Explore alternative values or indirect methods to achieve the policy goal if aliases are restricted for security reasons.
Deploy custom policies at the top-level management group for consistency across tenants, following the DRY principle.
5.Key Vault Policy Issues
Issue:
Policies for Azure Key Vault (e.g., auditing secret creation or access policies) don’t work as expected.
Causes:
- Data plane policies (e.g., secret creation) do not evaluate ARM template-based secrets until the 24-hour compliance scan.
- Insufficient Microsoft Entra permissions to modify access policies.
- Redeployment overwriting access policies without incremental options.
Solutions:
- Enable Key Vault logging to an Azure storage account to monitor policy evaluations (AzurePolicyEvaluationDetails container).
- Verify user permissions for modifying access policies and use managed identities for authentication where possible.
- Preserve access policies during redeployment by populating ARM templates with existing policies or switching to Azure RBAC for incremental updates.
- Review Key Vault logs for evaluation details and wait for the 24-hour compliance scan for data plane policies.
6. Performance and Scalability Issues
Issue:
Policy evaluations are slow or compliance data takes too long to update for large environments.
Causes:
- Large policy or initiative assignments evaluating many resources.
- Standard compliance scans (every 24 hours) or on-demand scans take time for large scopes.
Solutions:
- Be patient with evaluation cycles: new assignments (~5 minutes), resource updates (~15 minutes), subscriptions (~30 minutes). Optimize policy definitions by narrowing the scope or using exclusions to reduce the number of evaluated resources.
- Consider Enterprise Azure Policy as Code (EPAC) for scalable policy management in complex environments.
Notes:
- Always test policies in a non-production environment to avoid unintended disruptions.
- Regularly review policies to account for changes in Azure services or organizational requirements.
Published Apr 24, 2025
Version 1.0Balajiranganathan
Microsoft
Joined August 05, 2024
Azure Governance and Management Blog
Follow this blog board to get notified when there's new activity