-
Notifications
You must be signed in to change notification settings - Fork 6
/
shared_nsg_rules_azpolicy_allowLB.json
99 lines (99 loc) · 4.17 KB
/
shared_nsg_rules_azpolicy_allowLB.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
{
"mode": "All",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"DoNotEnforce",
"deployIfNotExists"
],
"defaultValue": "deployIfNotExists"
},
"priority": {
"type": "Integer",
"metadata": {
"displayName": "priority",
"description": "Priority for the deny any-to-any security rule (Example 4090).",
"defaultValue": 4090
}
}
},
"policyRule": {
"if": {
"field": "type",
"equals": "Microsoft.Network/networkSecurityGroups"
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.Network/networkSecurityGroups/securityRules",
"roleDefinitionIds": [
"/providers/Microsoft.Authorization/roleDefinitions/4d97b98b-1d4f-4787-a291-c67834d212e7"
],
"existenceCondition": {
"allof": [
{
"field": "Microsoft.Network/networkSecurityGroups/securityRules/access",
"equals": "Deny"
},
{
"field": "Microsoft.Network/networkSecurityGroups/securityRules/direction",
"equals": "Inbound"
},
{
"field": "Microsoft.Network/networkSecurityGroups/securityRules/destinationPortRange",
"equals": "*"
}
]
},
"deployment": {
"properties": {
"mode": "incremental",
"parameters": {
"nsgName": {
"value": "[field('name')]"
},
"priority": {
"value": "[parameters('priority')]"
}
},
"template": {
"$schema": "http://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"nsgName": {
"type": "string"
},
"priority": {
"type": "int"
}
},
"resources": [
{
"name": "[concat(parameters('nsgName'),'/Allow_ALB_Inbound')]",
"type": "Microsoft.Network/networkSecurityGroups/securityRules",
"apiVersion": "2019-11-01",
"properties": {
"description": "Allow Azure Load Balancer source IP address",
"protocol": "*",
"sourcePortRange": "168.63.129.16",
"destinationPortRange": "*",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": "[parameters('priority')]",
"direction": "Inbound"
}
}
]
}
}
}
}
}
}
}