-
Notifications
You must be signed in to change notification settings - Fork 517
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Policy Library (automated) (#204)
Co-authored-by: github-actions <action@github.com>
- Loading branch information
1 parent
ff088e3
commit 7f35807
Showing
2 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
.../lib/policy_definitions/policy_definition_es_deny_vnet_peering_to_non_approved_vnets.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
{ | ||
"name": "Deny-VNET-Peering-To-Non-Approved-VNETs", | ||
"type": "Microsoft.Authorization/policyDefinitions", | ||
"apiVersion": "2021-06-01", | ||
"scope": null, | ||
"properties": { | ||
"policyType": "Custom", | ||
"mode": "All", | ||
"displayName": "Deny vNet peering to non-approved vNets", | ||
"description": "This policy denies the creation of vNet Peerings to non-approved vNets under the assigned scope.", | ||
"metadata": { | ||
"version": "1.0.0", | ||
"category": "Network" | ||
}, | ||
"parameters": { | ||
"effect": { | ||
"type": "String", | ||
"metadata": { | ||
"displayName": "Effect", | ||
"description": "Enable or disable the execution of the policy" | ||
}, | ||
"allowedValues": [ | ||
"Audit", | ||
"Deny", | ||
"Disabled" | ||
], | ||
"defaultValue": "Deny" | ||
}, | ||
"allowedVnets": { | ||
"type": "Array", | ||
"metadata": { | ||
"displayName": "Allowed vNets to peer with", | ||
"description": "Array of allowed vNets that can be peered with. Must be entered using their resource ID. Example: /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}" | ||
}, | ||
"defaultValue": [] | ||
} | ||
}, | ||
"policyRule": { | ||
"if": { | ||
"anyOf": [ | ||
{ | ||
"allOf": [ | ||
{ | ||
"field": "type", | ||
"equals": "Microsoft.Network/virtualNetworks/virtualNetworkPeerings" | ||
}, | ||
{ | ||
"not": { | ||
"field": "Microsoft.Network/virtualNetworks/virtualNetworkPeerings/remoteVirtualNetwork.id", | ||
"in": "[parameters('allowedVnets')]" | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"allOf": [ | ||
{ | ||
"field": "type", | ||
"equals": "Microsoft.Network/virtualNetworks" | ||
}, | ||
{ | ||
"not": { | ||
"field": "Microsoft.Network/virtualNetworks/virtualNetworkPeerings[*].remoteVirtualNetwork.id", | ||
"in": "[parameters('allowedVnets')]" | ||
} | ||
}, | ||
{ | ||
"not": { | ||
"field": "Microsoft.Network/virtualNetworks/virtualNetworkPeerings[*].remoteVirtualNetwork.id", | ||
"exists": false | ||
} | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"then": { | ||
"effect": "[parameters('effect')]" | ||
} | ||
} | ||
} | ||
} |