Forum Discussion

abovethekloud's avatar
abovethekloud
Copper Contributor
Aug 22, 2019

Azure Blueprint: Allow resource only in specifc resource group

Hello all,

 

We would like to use blueprint to govern azure subscriptions. Within the blueprint we would like to deploy some kind of "core networking" resource group containing a VNET, which we can achieve using ARM template. So far so good, but we would like to prevent other VNET's being deployed to the subscription. I guess it should be possible somehow using policy and exclude the "core networking" resource group, but I havn't found a way jet.

 

 

2 Replies

  • camarvin's avatar
    camarvin
    Copper Contributor

    abovethekloud 

     

    For the policy, check out the https://docs.microsoft.com/en-us/azure/governance/policy/concepts/definition-structure#value and the resourcegroup() function.

     

    Something like (not tested):

    {
      "if": {
        "allOf": [
          {
            "field": "type",
            "like": "Microsoft.Network/*"
          },
          {
            "value": "[resourceGroup().name]",
            "notEquals": "CoreNetworking"
          }
        ]
      },
      "then": {
        "effect": "deny"
      }
    }

      

Resources