-
Notifications
You must be signed in to change notification settings - Fork 1
/
Apply Specific NSG - Public Facing.json
54 lines (54 loc) · 1.68 KB
/
Apply Specific NSG - Public Facing.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{
"properties": {
"displayName": "Apply specific NSG - Public Facing",
"policyType": "Custom",
"mode": "All",
"description": "Restricts the usage of NSGs to only those specific within the NSGid parameter",
"parameters": {
"nsgId": {
"type": "Array",
"metadata": {
"displayName": "NSG Id",
"description": "Resource Ids of the allowed Network Security Groups"
},
"allowedValues": [
"/subscriptions/829ac3c2/resourceGroups/ONLINE/providers/Microsoft.Network/networkSecurityGroups/ONLINE-NEU-NSG-001",
"/subscriptions/829ac3c2/resourceGroups/ONLINE/providers/Microsoft.Network/networkSecurityGroups/ONLINE-WEU-NSG-001"
]
}
},
"policyRule": {
"if": {
"anyOf": [
{
"allOf": [
{
"field": "type",
"equals": "Microsoft.Network/virtualNetworks"
},
{
"field": "Microsoft.Network/virtualNetworks/subnets[*].networkSecurityGroup.id",
"notin": "[parameters('nsgId')]"
}
]
},
{
"allOf": [
{
"field": "type",
"equals": "Microsoft.Network/virtualNetworks/subnets"
},
{
"field": "Microsoft.Network/virtualNetworks/subnets/networkSecurityGroup.id",
"notin": "[parameters('nsgId')]"
}
]
}
]
},
"then": {
"effect": "deny"
}
}
}
}