Forum Discussion
Asterixdev
Apr 30, 2021Copper Contributor
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
Sort By
- ersameed-AzureAcademyCopper Contributor
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')]"
}
}
} - ibnmbodjiSteel Contributor
Hi it's not possible to disable a vnet peering you have to delete the peering if you don't want communication between Vnets .
"Disabling the Allow virtual network access setting only changes the definition of the VirtualNetwork service tag. It doesn't fully prevent traffic flow across the peer connection, as explained in this setting description."
https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-manage-peering