title: azure arm policy to deny resource group without tags
body: <p>I want to write an Azure ARM Policy to deny the creation of Resource Groups if they don't have Tags. This is my current policy rule:</p>
  
  <pre><code>{
    "$schema": "http://schema.management.azure.com/schemas/2015-10-01-preview/policyDefinition.json",
    "if": {
      "allOf": [
        {
          "field": "tags",
          "exists": false
        },
        {
          "field": "type",
          "like": "resourceGroup*"
        }
      ]
    },
    "then": {
      "effect": "deny"
    }
  } 
  </code></pre>
  
  <p>This doesn't prevent the creation of RGs without tags.</p>
  
  <p>If I change the policy rule to:</p>
  
  <pre><code>{
    "$schema": "http://schema.management.azure.com/schemas/2015-10-01-preview/policyDefinition.json",
    "if": {
          "field": "tags",
          "exists": false
        },
    "then": {
      "effect": "deny"
    }
  } 
  </code></pre>
  
  <p>Then ALL resources (including RGs) are denied if they don't have tags. </p>
  
  <p>So I conclude it's part of the "field type is like resourcegroup*" condition, but I cannot find the correct syntax to make it work the way I want.</p>
  
  <p>Is this possible, and what is the correct syntax?</p>
  
  <p>(The reason I don't care if other resource type are created without tags is we have an Azure Automation runbook that grabs the tags for an RG, and then applies those to the child resources - which is also why I want to make sure people create the parent RG with tags in the first place).</p>