Forum Discussion

Asterixdev's avatar
Asterixdev
Copper Contributor
Apr 30, 2021

Disable Vnet peering

Hi,

We have Vnet Peering set up for two Vnets. For the purpose of some testing, we need to disable it. I have set the below settings for both Vnets 

 

 

The status of the Peering shows Connected, still. We are able to connect to the resources.

Please let me know if any further changes are required.

Thanks.

 

2 Replies

  • Use can you Azure policy - Scope will be specific Vnet or RG of Vnet

    {
        "policyType": "Custom",
        "mode": "All",
        "displayName": "Deny vNet peering ",
        "description": "This policy denies the creation of vNet Peerings under the assigned scope.",
        "metadata": {
            "version": "1.0.1",
            "category": "Network"
        },
        "parameters": {
            "effect": {
                "type": "String",
                "allowedValues": [
                    "Audit",
                    "Deny",
                    "Disabled"
                ],
                "defaultValue": "Deny",
                "metadata": {
                    "displayName": "Effect",
                    "description": "Enable or disable the execution of the policy"
                }
            }
        },
        "policyRule": {
            "if": {
                "field": "type",
                "equals": "Microsoft.Network/virtualNetworks/virtualNetworkPeerings"
            },
            "then": {
                "effect": "[parameters('effect')]"
            }
        }
    }

Resources