@@ -152,7 +152,7 @@ Use [Add-AzVirtualNetworkSubnetConfig](/powershell/module/az.network/add-azvirtu
152
152
# Create subnet for Azure Firewall
153
153
$subnetParams = @{
154
154
Name = 'AzureFirewallSubnet'
155
- AddressPrefix = '10.0.1.64/64 '
155
+ AddressPrefix = '10.0.1.64/26 '
156
156
VirtualNetwork = $hubVnet
157
157
}
158
158
Add-AzVirtualNetworkSubnetConfig @subnetParams
@@ -181,8 +181,9 @@ $publicIpBastionParams = @{
181
181
ResourceGroupName = 'test-rg'
182
182
Location = 'South Central US'
183
183
Name = 'public-ip-bastion'
184
- AllocationMethod = 'Static'
185
184
Sku = 'Standard'
185
+ AllocationMethod = 'Static'
186
+ Zone = 1, 2, 3
186
187
}
187
188
$publicIpBastion = New-AzPublicIpAddress @publicIpBastionParams
188
189
```
@@ -192,11 +193,12 @@ Use [New-AzBastion](/powershell/module/az.network/new-azbastion) to create Azure
192
193
``` powershell
193
194
# Create Azure Bastion
194
195
$bastionParams = @{
195
- ResourceGroupName = 'test-rg'
196
- Location = 'South Central US'
197
- Name = 'bastion'
198
- PublicIpAddress = $publicIpBastion
199
- VirtualNetwork = $hubVnet
196
+ ResourceGroupName = "test-rg"
197
+ Name = "bastion"
198
+ VirtualNetworkName = "vnet-hub"
199
+ PublicIpAddressName = "public-ip-bastion"
200
+ PublicIPAddressRgName = "test-rg"
201
+ VirtualNetworkRgName = "test-rg"
200
202
}
201
203
New-AzBastion @bastionParams
202
204
```
@@ -211,24 +213,11 @@ $publicIpFirewallParams = @{
211
213
Name = 'public-ip-firewall'
212
214
AllocationMethod = 'Static'
213
215
Sku = 'Standard'
216
+ Zone = 1, 2, 3
214
217
}
215
218
$publicIpFirewall = New-AzPublicIpAddress @publicIpFirewallParams
216
219
```
217
220
218
- Use [ New-AzFirewall] ( /powershell/module/az.network/new-azfirewall ) to create Azure Firewall.
219
-
220
- ``` powershell
221
- # Create Azure Firewall
222
- $firewallParams = @{
223
- ResourceGroupName = 'test-rg'
224
- Location = 'South Central US'
225
- Name = 'firewall'
226
- VirtualNetwork = $hubVnet
227
- PublicIpAddress = $publicIpFirewall
228
- }
229
- $firewall = New-AzFirewall @firewallParams
230
- ```
231
-
232
221
Use [ New-AzFirewallPolicy] ( /powershell/module/az.network/new-azfirewallpolicy ) to create a firewall policy.
233
222
234
223
``` powershell
@@ -241,18 +230,22 @@ $firewallPolicyParams = @{
241
230
$firewallPolicy = New-AzFirewallPolicy @firewallPolicyParams
242
231
```
243
232
244
- Use [ Set -AzFirewall] ( /powershell/module/az.network/set -azfirewall ) to associate the firewall policy with the firewall .
233
+ Use [ New -AzFirewall] ( /powershell/module/az.network/new -azfirewall ) to create Azure Firewall .
245
234
246
235
``` powershell
247
- # Associate firewall policy with firewall
248
- $firewallUpdateParams = @{
236
+ # Create Azure Firewall
237
+ $firewallParams = @{
249
238
ResourceGroupName = 'test-rg'
239
+ Location = 'South Central US'
250
240
Name = 'firewall'
251
- FirewallPolicy = $firewallPolicy
241
+ VirtualNetworkName = 'vnet-hub'
242
+ PublicIpName = 'public-ip-firewall'
243
+ FirewallPolicyId = $firewallPolicy.Id
252
244
}
253
- Set -AzFirewall @firewallUpdateParams
245
+ $firewall = New -AzFirewall @firewallParams
254
246
```
255
247
248
+
256
249
### [ CLI] ( #tab/cli )
257
250
258
251
Use [ az group create] ( /cli/azure/group#az_group_create ) to create a resource group.
@@ -395,13 +388,13 @@ $publicIpNat = New-AzPublicIpAddress @publicIpNatParams
395
388
Use [ New-AzNatGateway] ( /powershell/module/az.network/new-aznatgateway ) to create the NAT gateway.
396
389
397
390
``` powershell
398
- # Create NAT gateway
399
391
$natGatewayParams = @{
400
392
ResourceGroupName = 'test-rg'
401
- Location = 'South Central US'
402
393
Name = 'nat-gateway'
403
394
PublicIpAddress = $publicIpNat
395
+ Sku = 'Standard'
404
396
IdleTimeoutInMinutes = 4
397
+ Location = 'South Central US'
405
398
}
406
399
$natGateway = New-AzNatGateway @natGatewayParams
407
400
```
@@ -413,6 +406,7 @@ Use [Set-AzVirtualNetworkSubnetConfig](/powershell/module/az.network/set-azvirtu
413
406
$subnetParams = @{
414
407
VirtualNetwork = $hubVnet
415
408
Name = 'AzureFirewallSubnet'
409
+ AddressPrefix = '10.0.1.64/26'
416
410
NatGateway = $natGateway
417
411
}
418
412
Set-AzVirtualNetworkSubnetConfig @subnetParams
@@ -776,7 +770,7 @@ $routeConfigParams = @{
776
770
Name = 'route-to-hub'
777
771
AddressPrefix = '0.0.0.0/0'
778
772
NextHopType = 'VirtualAppliance'
779
- NextHopIpAddress = '10.0.1.68'
773
+ NextHopIpAddress = $firewall.IpConfigurations[0].PrivateIpAddress
780
774
RouteTable = $routeTable
781
775
}
782
776
Add-AzRouteConfig @routeConfigParams
@@ -796,6 +790,7 @@ Use [Set-AzVirtualNetworkSubnetConfig](/powershell/module/az.network/set-azvirtu
796
790
$subnetConfigParams = @{
797
791
VirtualNetwork = $spokeVnet
798
792
Name = 'subnet-private'
793
+ AddressPrefix = '10.1.0.0/24'
799
794
RouteTable = $routeTable
800
795
}
801
796
Set-AzVirtualNetworkSubnetConfig @subnetConfigParams
@@ -881,21 +876,9 @@ Traffic from the spoke through the hub must be allowed through and firewall poli
881
876
882
877
### [ PowerShell] ( #tab/powershell )
883
878
884
- Use [ New-AzFirewallPolicyNetworkRuleCollection] ( /powershell/module/az.network/new-azfirewallpolicynetworkrulecollection ) to create a network rule collection.
885
879
886
- ``` powershell
887
- # Create network rule collection
888
- $networkRuleCollectionParams = @{
889
- Name = 'spoke-to-internet'
890
- Priority = 100
891
- RuleCollectionType = 'NetworkRuleCollection'
892
- ActionType = 'Allow'
893
- RuleCollectionGroup = 'DefaultNetworkRuleCollectionGroup'
894
- }
895
- $networkRuleCollection = New-AzFirewallPolicyNetworkRuleCollection @networkRuleCollectionParams
896
- ```
897
880
898
- Use [ New-AzFirewallPolicyNetworkRule ] ( /powershell/module/az.network/new-azfirewallpolicynetworkrule ) to create a network rule.
881
+ Use [ New-AzFirewallNetworkRule ] ( /powershell/module/az.network/new-azfirewallnetworkrule ) to create a network rule.
899
882
900
883
``` powershell
901
884
# Create network rule
@@ -906,11 +889,23 @@ $networkRuleParams = @{
906
889
DestinationPort = '80,443'
907
890
Protocol = 'TCP'
908
891
}
909
- $networkRule = New-AzFirewallPolicyNetworkRule @networkRuleParams
910
- # Add network rule to collection
911
- $networkRuleCollection.Rules.Add($networkRule)
892
+ $networkRule = New-AzFirewallNetworkRule @networkRuleParams
912
893
```
913
894
895
+ Use [ New-AzFirewallNetworkRuleCollection] ( /powershell/module/az.network/new-azfirewallnetworkrulecollection ) to create a network rule collection.
896
+
897
+ ``` powershell
898
+ # Create network rule collection
899
+ $networkRuleCollectionParams = @{
900
+ Name = 'spoke-to-internet'
901
+ Priority = 100
902
+ Rule = $networkRule
903
+ ActionType = 'Allow'
904
+ }
905
+ $networkRuleCollection = New-AzFirewallNetworkRuleCollection @networkRuleCollectionParams
906
+ ```
907
+
908
+
914
909
Use [ Set-AzFirewallPolicy] ( /powershell/module/az.network/set-azfirewallpolicy ) to update the firewall policy.
915
910
916
911
``` powershell
0 commit comments