Apply exclusion to policy or initiative based on resource region

Dan Pier 1 Reputation point
2021-01-28T22:07:49.033+00:00

Hi, I am configuring resource diagnostic settings via policies within initiatives.

The diagnostic settings will be configured to send to log analytics workspace and storage account in the same region as the resource.

We deploy across four regions so would like to use four initiatives applied at subscription level, one for each region with exclusions for the other regions based on the resource location. Is this possible?

Thanks

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

1 answer

Sort by: Most helpful
  1. Dan Pier 1 Reputation point
    2021-02-02T09:25:55.877+00:00

    Hi @tbgangav-MSFT

    Thanks for the message. I actually figured it out yesterday using logical operators within the policy template. https://learn.microsoft.com/en-us/azure/governance/policy/samples/pattern-logical-operators

    For information of the community, I simply added the following as an example:

    "policyRule": {  
      "if": {  
        "allOf": [  
          {  
            "field": "type",  
            "equals": "Microsoft.Cache/redis"  
          },  
          {  
            "field": "location",  
            "equals": "uksouth"  
          }  
        ]  
      },