Skip to content

Commit

Permalink
added policy to deny vnet peering removal
Browse files Browse the repository at this point in the history
  • Loading branch information
digitmj committed Jan 13, 2024
1 parent 67a6b1b commit 7cc9383
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"name": "6f194805-9450-4e29-bd6a-9bc370329126",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "Deny VNet peering removal",
"description": "This Policy will deny the deletion of VNets peerings with a specified name.",
"metadata": {
"version": "1.0.0",
"category": "Network"
},
"mode": "All",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "DenyAction or Disabled the execution of the Policy"
},
"allowedValues": [
"DenyAction",
"Disabled"
],
"defaultValue": "DenyAction"
},
"peeringName": {
"type": "String",
"metadata": {
"displayName": "VNet peering name",
"description": "Name of the VNet peering that is not allowed to be removed"
},
"defaultValue": "Spoke-to-Hub"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Network/virtualNetworks/virtualNetworkPeerings"
},
{
"field": "name",
"equals": "[parameters('peeringName')]"
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"actionNames": [
"delete"
]
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "DenyAction or Disabled the execution of the Policy"
},
"allowedValues": [
"DenyAction",
"Disabled"
],
"defaultValue": "DenyAction"
},
"peeringName": {
"type": "String",
"metadata": {
"displayName": "VNet peering name",
"description": "Name of the VNet peering that is not allowed to be removed"
},
"defaultValue": "Spoke-to-Hub"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Network/virtualNetworks/virtualNetworkPeerings"
},
{
"field": "name",
"equals": "[parameters('peeringName')]"
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"actionNames": [
"delete"
]
}
}
}

0 comments on commit 7cc9383

Please sign in to comment.