Skip to content

Commit dc77f9f

Browse files
committed
code reformat
1 parent 7b72b1c commit dc77f9f

File tree

1 file changed

+45
-22
lines changed

1 file changed

+45
-22
lines changed

articles/nat-gateway/tutorial-hub-spoke-nat-firewall.md

Lines changed: 45 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -876,46 +876,67 @@ Traffic from the spoke through the hub must be allowed through and firewall poli
876876

877877
### [PowerShell](#tab/powershell)
878878

879+
Use [New-AzFirewallPolicyRuleCollectionGroup](/powershell/module/az.network/new-azfirewallpolicyrulecollectiongroup) to create a rule collection group.
879880

881+
```powershell
882+
$firewallPolicyParams = @{
883+
Name = 'firewall-policy'
884+
ResourceGroupName = 'test-rg'
885+
}
886+
$firewallpolicy = Get-AzFirewallPolicy @firewallPolicyParams
887+
888+
$newNetworkRuleCollectionGroupParams = @{
889+
Name = 'DefaultNetworkRuleCollectionGroup'
890+
Priority = 200
891+
ResourceGroupName = 'test-rg'
892+
FirewallPolicyName = 'firewall-policy'
893+
}
894+
$newnetworkrulecollectiongroup = New-AzFirewallPolicyRuleCollectionGroup @newNetworkRuleCollectionGroupParams
895+
896+
$networkRuleCollectionGroupParams = @{
897+
Name = 'DefaultNetworkRuleCollectionGroup'
898+
ResourceGroupName = 'test-rg'
899+
AzureFirewallPolicyName = 'firewall-policy'
900+
}
901+
$networkrulecollectiongroup = Get-AzFirewallPolicyRuleCollectionGroup @networkRuleCollectionGroupParams
902+
```
880903

881-
Use [New-AzFirewallNetworkRule](/powershell/module/az.network/new-azfirewallnetworkrule) to create a network rule.
904+
Use [New-AzFirewallPolicyNetworkRule](/powershell/module/az.network/new-azfirewallpolicynetworkrule) to create a network rule.
882905

883906
```powershell
884-
# Create network rule
885907
$networkRuleParams = @{
886908
Name = 'allow-web'
887909
SourceAddress = '10.1.0.0/24'
910+
Protocol = 'TCP'
888911
DestinationAddress = '*'
889912
DestinationPort = '80,443'
890-
Protocol = 'TCP'
891913
}
892-
$networkRule = New-AzFirewallNetworkRule @networkRuleParams
914+
$networkrule = New-AzFirewallPolicyNetworkRule @networkRuleParams
893915
```
894916

895-
Use [New-AzFirewallNetworkRuleCollection](/powershell/module/az.network/new-azfirewallnetworkrulecollection) to create a network rule collection.
917+
Use [New-AzFirewallPolicyFilterRuleCollection](/powershell/module/az.network/new-azfirewallpolicyfilterrulecollection) to create a rule collection.
896918

897919
```powershell
898-
# Create network rule collection
899-
$networkRuleCollectionParams = @{
900-
Name = 'spoke-to-internet'
901-
Priority = 100
902-
Rule = $networkRule
920+
$newRuleCollectionConfigParams = @{
921+
Name = 'rule-collection'
922+
Priority = 1000
923+
Rule = $networkrule
903924
ActionType = 'Allow'
904925
}
905-
$networkRuleCollection = New-AzFirewallNetworkRuleCollection @networkRuleCollectionParams
926+
$newrulecollectionconfig = New-AzFirewallPolicyFilterRuleCollection @newRuleCollectionConfigParams
927+
$newrulecollection = $networkrulecollectiongroup.Properties.RuleCollection.Add($newrulecollectionconfig)
906928
```
907929

908-
909-
Use [Set-AzFirewallPolicy](/powershell/module/az.network/set-azfirewallpolicy) to update the firewall policy.
930+
Use [Set-AzFirewallPolicyRuleCollectionGroup](/powershell/module/az.network/set-azfirewallpolicyrulecollectiongroup) to update the rule collection group.
910931

911932
```powershell
912-
# Update firewall policy
913-
$firewallPolicyParams = @{
914-
ResourceGroupName = 'test-rg'
915-
Name = 'firewall-policy'
916-
NetworkRuleCollection = $networkRuleCollection
933+
$setRuleCollectionGroupParams = @{
934+
Name = 'DefaultNetworkRuleCollectionGroup'
935+
Priority = 200
936+
FirewallPolicyObject = $firewallpolicy
937+
RuleCollection = $networkrulecollectiongroup.Properties.RuleCollection
917938
}
918-
Set-AzFirewallPolicy @firewallPolicyParams
939+
Set-AzFirewallPolicyRuleCollectionGroup @setRuleCollectionGroupParams
919940
```
920941

921942
### [CLI](#tab/cli)
@@ -997,13 +1018,15 @@ Wait for the virtual machine to finishing deploying before proceeding to the nex
9971018
9981019
### [PowerShell](#tab/powershell)
9991020

1000-
Use [Get-Credential](/powershell/module/microsoft.powershell.security/get-credential) to create a credential object for the virtual machine.
1021+
Use [Get-Credential](/powershell/module/microsoft.powershell.security/get-credential) to set a user name and password for the VM and store them in the `$cred` variable.
10011022

1002-
```powershell
1003-
# Create credential object
1023+
```azurepowershell
10041024
$cred = Get-Credential
10051025
```
10061026

1027+
> [!NOTE]
1028+
> A username is required for the VM. The password is optional and won't be used if set. SSH key configuration is recommended for Linux VMs.
1029+
10071030
Use [New-AzNetworkSecurityGroup](/powershell/module/az.network/new-aznetworksecuritygroup) to create a network security group.
10081031

10091032
```powershell

0 commit comments

Comments
 (0)