-
Notifications
You must be signed in to change notification settings - Fork 1
/
NSG in specific Region.json
53 lines (53 loc) · 2.08 KB
/
NSG in specific Region.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
{
"properties": {
"displayName": "NSG X on every subnet within the Public Management Group",
"description": "This policy enforces a specific NSG on every subnet",
"mode": "All",
"parameters": {
"nsgId": {
"type": "Array",
"metadata": {
"description": "Resource Ids of the allowed Network Security Groups",
"displayName": "NSG Id"
},
"allowedValues": [
"/subscriptions/SUBSCRIPTIONID/resourceGroups/RGNAME/providers/Microsoft.Network/networkSecurityGroups/RGNAME-CORP-NEU-NSG-001",
"/subscriptions/SUBSCRIPTIONID/resourceGroups/RGNAME/providers/Microsoft.Network/networkSecurityGroups/RGNAME-CORP-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"
}
}
}
}