Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add policy to deny vnet peering removal #417

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
]
}
}
}