forked from fawohlsc/azure-policy-testing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAudit-Route-NextHopVirtualAppliance.json
102 lines (102 loc) · 4.38 KB
/
Audit-Route-NextHopVirtualAppliance.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
100
101
102
{
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"variables": {
"policyName": "Audit-Route-NextHopVirtualAppliance",
"policyDescription": "Audit route tables for route with address prefix 0.0.0.0/0 pointing to the virtual appliance.",
"policyCategory": "Network",
"policyAssignmentParameters": {
"routeTableSettings": {
"value": {
"northeurope": {
"virtualApplianceIpAddress": "10.0.0.23"
},
"westeurope": {
"virtualApplianceIpAddress": "10.1.0.23"
},
"disabled": {
"virtualApplianceIpAddress": ""
}
}
}
}
},
"resources": [
{
"name": "[variables('policyName')]",
"type": "Microsoft.Authorization/policyDefinitions",
"apiVersion": "2020-03-01",
"properties": {
"policyType": "Custom",
"mode": "All",
"displayName": "[variables('policyName')]",
"description": "[variables('policyDescription')]",
"metadata": {
"category": "[variables('policyCategory')]"
},
"parameters": {
"routeTableSettings": {
"type": "Object",
"metadata": {
"displayName": "Route Table Settings",
"description": "Location-specific settings for route tables."
}
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Network/routeTables"
},
{
"count": {
"field": "Microsoft.Network/routeTables/routes[*]",
"where": {
"allOf": [
{
"field": "Microsoft.Network/routeTables/routes[*].addressPrefix",
"equals": "0.0.0.0/0"
},
{
"field": "Microsoft.Network/routeTables/routes[*].nextHopType",
"equals": "VirtualAppliance"
},
{
"field": "Microsoft.Network/routeTables/routes[*].nextHopIpAddress",
"equals": "[[parameters('routeTableSettings')[field('location')].virtualApplianceIpAddress]"
}
]
}
},
"equals": 0
}
]
},
"then": {
"effect": "audit"
}
}
}
},
{
"name": "[uniqueString(variables('policyName'))]",
"type": "Microsoft.Authorization/policyAssignments",
"apiVersion": "2020-03-01",
"properties": {
"displayName": "[variables('policyName')]",
"policyDefinitionId": "[resourceId('Microsoft.Authorization/policyDefinitions', variables('policyName'))]",
"parameters": "[variables('policyAssignmentParameters')]",
"description": "[variables('policyDescription')]",
"metadata": {
"category": "[variables('policyCategory')]"
},
"enforcementMode": "Default"
},
"dependsOn": [
"[resourceId('Microsoft.Authorization/policyDefinitions', variables('policyName'))]"
]
}
]
}