-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbastionhost.bicep
More file actions
173 lines (169 loc) · 4.09 KB
/
bastionhost.bicep
File metadata and controls
173 lines (169 loc) · 4.09 KB
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
param location string
param bastionHostName string
param virtualNetworkName string
param bastionSubnetIpPrefix string
param ipaddress string
resource publicIp 'Microsoft.Network/publicIPAddresses@2020-11-01' = {
name: '${bastionHostName}-pip'
location: location
sku: {
name: 'Standard'
}
properties: {
publicIPAllocationMethod: 'Static'
}
}
resource BastionIngressEgressTrafficeNSG 'Microsoft.Network/networkSecurityGroups@2020-11-01' = {
name: '${bastionHostName}-nsg'
location:location
properties:{
securityRules:[
{
name: 'AllowHttpsInbound'
properties:{
protocol:'Tcp'
direction:'Inbound'
access:'Allow'
sourceAddressPrefixes:[
ipaddress
]
destinationPortRanges:[
'443'
]
priority: 100
destinationAddressPrefix: '*'
sourcePortRange: '*'
}
}
{
name: 'AllowGatewayManagerInbound'
properties:{
protocol:'Tcp'
direction:'Inbound'
access:'Allow'
sourceAddressPrefix: 'GatewayManager'
destinationPortRanges:[
'443'
]
priority: 110
destinationAddressPrefix: '*'
sourcePortRange: '*'
}
}
{
name: 'AllowAzureLoadBalancerInbound'
properties:{
protocol:'Tcp'
direction:'Inbound'
access:'Allow'
sourceAddressPrefix: 'AzureLoadBalancer'
destinationPortRanges:[
'443'
]
priority: 120
destinationAddressPrefix: '*'
sourcePortRange: '*'
}
}
{
name: 'AllowBastionHostCommunication'
properties:{
protocol:'*'
direction:'Inbound'
access:'Allow'
sourceAddressPrefix: 'VirtualNetwork'
destinationPortRanges:[
'8080'
'5701'
]
priority: 130
destinationAddressPrefix: 'VirtualNetwork'
sourcePortRange: '*'
}
}
{
name: 'AllowSshRdpOutbound'
properties:{
protocol:'Tcp'
direction:'Outbound'
access:'Allow'
sourceAddressPrefix: '*'
destinationPortRanges:[
'22'
'3389'
]
priority: 100
destinationAddressPrefix: 'VirtualNetwork'
sourcePortRange: '*'
}
}
{
name: 'AllowAzureCloudOutbound'
properties:{
protocol:'Tcp'
direction:'Outbound'
access:'Allow'
sourceAddressPrefix: '*'
sourcePortRange: '*'
destinationAddressPrefix: 'AzureCloud'
destinationPortRange: '443'
priority: 110
}
}
{
name: 'AllowBastioncommunication'
properties:{
protocol:'Tcp'
direction:'Outbound'
access:'Allow'
sourceAddressPrefix: 'VirtualNetwork'
sourcePortRange: '*'
destinationAddressPrefix: 'VirtualNetwork'
destinationPortRange: '*'
priority: 120
}
}
{
name: 'AllowGetSessionInformation'
properties:{
protocol:'*'
direction:'Outbound'
access:'Allow'
sourceAddressPrefix: '*'
sourcePortRange: '*'
destinationAddressPrefix: 'Internet'
destinationPortRange: '80'
priority: 130
}
}
]
}
}
resource subNet 'Microsoft.Network/virtualNetworks/subnets@2020-11-01' = {
name: '${virtualNetworkName}/AzureBastionSubnet'
properties: {
addressPrefix: bastionSubnetIpPrefix
networkSecurityGroup:{
id:BastionIngressEgressTrafficeNSG.id
}
}
}
resource bastionHost 'Microsoft.Network/bastionHosts@2020-11-01' = {
name: bastionHostName
location: location
properties: {
ipConfigurations: [
{
name: 'IpConf'
properties: {
subnet: {
id: subNet.id
}
publicIPAddress: {
id: publicIp.id
}
}
}
]
}
}