-
Notifications
You must be signed in to change notification settings - Fork 165
/
appgw.json
173 lines (173 loc) · 7.31 KB
/
appgw.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"parameters": {
"moodleCommon": {
"metadata": {
"description": "Common Moodle values"
},
"type": "object"
},
"subnetIdAppGw": {
"metadata": {
"description": "Azure resource ID of the subnet where this App Gw should be deployed"
},
"type": "string"
},
"sslCertData": {
"metadata": {
"description": "Base64-encoded PFX (no password protected) file content for the SSL cert to be used on the App Gateway for SSL termination. Should be passed from an Azure Key Vault."
},
"type": "securestring"
}
},
"resources": [
{
"type": "Microsoft.Network/applicationGateways",
"name": "[parameters('moodleCommon').appGwName]",
"location": "[parameters('moodleCommon').location]",
"apiVersion": "2019-11-01",
"properties": {
"sku": {
"name": "[parameters('moodleCommon').appGwSkuName]",
"tier": "[parameters('moodleCommon').appGwSkuTier]",
"capacity": "[parameters('moodleCommon').appGwSkuCapacity]"
},
"gatewayIPConfigurations": [
{
"name": "appGwIpConfig",
"properties": {
"subnet": {
"id": "[parameters('subnetIdAppGw')]"
}
}
}
],
"frontendIPConfigurations": [
{
"name": "appGwFrontendIP",
"properties": {
"publicIPAddress": {
"id": "[variables('appGwPublicIPAddressID')]"
}
}
}
],
"frontendPorts": [
{
"name": "httpsFrontendPort",
"properties": {
"port": 443
}
},
{
"name": "httpFrontendPort",
"properties": {
"port": 80
}
}
],
"backendAddressPools": [
{
"name": "[variables('appGwBePoolName')]"
}
],
"backendHttpSettingsCollection": [
{
"name": "appGwBackendHttpSettings",
"properties": {
"port": 80,
"protocol": "Http",
"cookieBasedAffinity": "Disabled"
}
}
],
"sslCertificates": [
{
"name": "appGatewaySslCert",
"properties": {
"data": "[parameters('sslCertData')]"
}
}
],
"httpListeners": [
{
"name": "appGwHttpsListener",
"properties": {
"frontendIPConfiguration": {
"Id": "[concat(variables('appGwID'), '/frontendIPConfigurations/appGwFrontendIP')]"
},
"frontendPort": {
"Id": "[concat(variables('appGwID'), '/frontendPorts/httpsFrontendPort')]"
},
"protocol": "Https",
"sslCertificate": {
"Id": "[concat(variables('appGwID'), '/sslCertificates/appGatewaySslCert')]"
}
}
},
{
"name": "appGwHttpListener",
"properties": {
"frontendIPConfiguration": {
"Id": "[concat(variables('appGwID'), '/frontendIPConfigurations/appGwFrontendIP')]"
},
"frontendPort": {
"Id": "[concat(variables('appGwID'), '/frontendPorts/httpFrontendPort')]"
},
"protocol": "Http"
}
}
],
"redirectConfigurations": [
{
"name": "httpToHttps",
"properties": {
"redirectType":"Permanent",
"includePath" : true,
"includeQueryString" : true,
"targetListener": {
"id": "[concat(variables('appGwID'), '/httpListeners/appGwHttpsListener')]"
}
}
}
],
"requestRoutingRules": [
{
"Name": "httpsRule",
"properties": {
"ruleType": "Basic",
"httpListener": {
"id": "[concat(variables('appGwID'), '/httpListeners/appGwHttpsListener')]"
},
"backendAddressPool": {
"id": "[concat(variables('appGwID'), '/backendAddressPools/', variables('appGwBePoolName'))]"
},
"backendHttpSettings": {
"id": "[concat(variables('appGwID'), '/backendHttpSettingsCollection/appGwBackendHttpSettings')]"
}
}
},
{
"Name": "httpRedirectRule",
"properties": {
"ruleType": "Basic",
"httpListener": {
"id": "[concat(variables('appGwID'), '/httpListeners/appGwHttpListener')]"
},
"redirectConfiguration": {
"id": "[concat(variables('appGwID'), '/redirectConfigurations/httpToHttps')]"
}
}
}
]
}
}
],
"variables": {
"documentation1": "This sub-template creates an Azure Application Gateway for SSL offloading. It expects certain values in the 'common' datastructure.",
"appGwBePoolName": "[parameters('moodleCommon').appGwBePoolName]",
"appGwPublicIPAddressID": "[resourceId('Microsoft.Network/publicIPAddresses',parameters('moodleCommon').appGwPipName)]",
"appGwID": "[resourceId('Microsoft.Network/applicationGateways', parameters('moodleCommon').appGwName)]"
}
}