how to deny vnet peering between two management groups?

sonia sonia 20 Reputation points
2023-02-14T05:12:13.3733333+00:00

Hi all,

We are trying to deny vent peering between two management groups scope but not sure how can we accomplish. Can any one help with this?

Thanks

Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,666 questions
Azure Policy
Azure Policy
An Azure service that is used to implement corporate governance and standards at scale for Azure resources.
971 questions
{count} votes

Accepted answer
  1. Fabricio Godoy 2,611 Reputation points
    2023-02-16T04:20:41.6933333+00:00

    Helo Sonia.

    To deny VNet peering between two Azure Management Groups, you can use Azure Policy to create a policy definition that restricts the ability to peer VNets across management groups.

    u can use the Azure Policy portal, Azure PowerShell, or Azure CLI to create the policy

    ex:

    {
      "mode": "All",
      "policyRule": {
        "if": {
          "allOf": [
            {
              "field": "Microsoft.Network/virtualNetworkPeerings",
              "exists": "true"
            },
            {
              "field": "Microsoft.Network/virtualNetworkPeerings/remoteVirtualNetwork.id",
              "notLike": "/providers/Microsoft.Management/managementGroups/*"
            }
          ]
        },
        "then": {
          "effect": "deny"
        }
      },
      "parameters": {}
    }
    
    

    Assign the policy to a management group. (you can choose to apply it to all child management groups and subscriptions)

    I hope this is help u.

    Regards

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.