-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreatingLoadBalancer.json
119 lines (117 loc) · 4.02 KB
/
creatingLoadBalancer.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
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"publicIpName": {
"type": "string",
"metadata": {
"description": "Specifies a unique public DNS prefix for the deployment. This will produce a FQDN of the form '<publicDnsName>.<location>.cloudapp.azure.com'. Up to 62 chars, digits or dashes, lowercase, should start with a letter: must conform to '^[a-z][a-z0-9-]{1,61}[a-z0-9]$'."
}
},
"publicIpGroup": {
"type": "string",
"defaultValue": "[resourceGroup().name]",
"metadata": {
"description": "Specifies the resource group which should contain the public IP."
}
},
"loadBalancerName": {
"type": "string",
"metadata": {
"description": "Specifies the resource name of the load balancer."
}
},
"inboundRules": {
"type": "array",
"metadata": {
"description": "Specifies a list of inbound rules to create on the load balancer."
}
},
"location": {
"type": "string",
"defaultValue": "[resourcegroup().location]",
"metadata": {
"description": "Specifies the Location for the deployment."
}
}
},
"variables": {
"rulecount": "[int(sub(length(parameters('inboundRules')), 1))]"
},
"resources": [
{
"apiVersion": "2015-06-15",
"name": "[parameters('loadBalancerName')]",
"type": "Microsoft.Network/loadBalancers",
"location": "[parameters('location')]",
"tags": {
"displayName": "LoadBalancer"
},
"properties": {
"frontendIPConfigurations": [
{
"name": "LBFE",
"properties": {
"publicIPAddress": {
"id": "[resourceId(parameters('publicIpGroup'),'Microsoft.Network/publicIPAddresses', parameters('publicIpName'))]"
}
}
}
],
"backendAddressPools": [
{
"name": "LBBAP"
}
],
"inboundNatRules": [
]
}
},
{
"apiVersion": "2015-06-15",
"name": "[concat(parameters('loadBalancerName'), '/', parameters('inboundRules')[0].name)]",
"type": "Microsoft.Network/loadBalancers/inboundNatRules",
"dependsOn": [ "Microsoft.Network/loadBalancers/LoadBalancer" ],
"properties": {
"frontendIPConfiguration": {
"id": "[concat(resourceId('Microsoft.Network/loadBalancers','loadBalancer'),'/frontendIPConfigurations/LBFE')]"
},
"protocol": "tcp",
"frontendPort": "[parameters('inboundRules')[0].frontendPort]",
"backendPort": "[parameters('inboundRules')[0].backendPort]",
"enableFloatingIP": false
}
},
{
"apiVersion": "2015-06-15",
"type": "Microsoft.Network/loadBalancers/inboundNatRules",
"name": "[concat(parameters('loadBalancerName'), '/', parameters('inboundRules')[copyIndex(1)].name)]",
"dependsOn": [
"[concat('Microsoft.Network/loadBalancers/',parameters('loadBalancerName'),'/inboundNatRules/', parameters('inboundRules')[copyIndex()].name)]"
],
"copy": {
"name": "inboundNatRulesCopy",
"count": "[variables('rulecount')]"
},
"properties": {
"frontendIPConfiguration": {
"id": "[concat(resourceId('Microsoft.Network/loadBalancers','loadBalancer'),'/frontendIPConfigurations/LBFE')]"
},
"protocol": "tcp",
"frontendPort": "[parameters('inboundRules')[copyIndex(1)].frontendPort]",
"backendPort": "[parameters('inboundRules')[copyIndex(1)].backendPort]",
"enableFloatingIP": false
}
}
],
"outputs": {
"lbfeId": {
"type": "string",
"value": "[concat(resourceId('Microsoft.Network/loadBalancers','loadBalancer'),'/frontendIPConfigurations/LBFE')]"
},
"lbbapId": {
"type": "string",
"value": "[concat(resourceId('Microsoft.Network/loadBalancers','loadBalancer'),'/backendAddressPools/LBBAP')]"
}
}
}