Skip to content

Commit 5ce02d4

Browse files
authored
Merge pull request Azure#8903 from fanymanea/UpdateAzureFirewallExamples
Update AzureFirewall examples
2 parents 79067dc + 669c57c commit 5ce02d4

File tree

3 files changed

+36
-18
lines changed

3 files changed

+36
-18
lines changed

src/Network/Network/help/New-AzFirewall.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ The **New-AzFirewall** cmdlet creates an Azure Firewall.
3838

3939
### 1: Create a Firewall attached to a virtual network
4040
```
41-
New-AzFirewall -Name "azFw" -ResourceGroupName "rg" -Location centralus -VirtualNetworkName "vnet" -PublicIpName "pip-name"
41+
$rgName = "resourceGroupName"
42+
$vnet = Get-AzVirtualNetwork -ResourceGroupName $rgName -Name "vnet"
43+
$pip = Get-AzPublicIpAddress -ResourceGroupName $rgName -Name "publicIpName"
44+
New-AzFirewall -Name "azFw" -ResourceGroupName $rgName -Location centralus -VirtualNetworkName $vnet.Name -PublicIpName $pip.Name
4245
```
4346

4447
This example creates a Firewall attached to virtual network "vnet" in the same resource group as the firewall.
@@ -47,9 +50,13 @@ Threat Intel will also run in default mode - Alert - which means malicious traff
4750

4851
### 2: Create a Firewall which allows all HTTPS traffic
4952
```
53+
$rgName = "resourceGroupName"
54+
$vnet = Get-AzVirtualNetwork -ResourceGroupName $rgName -Name "vnet"
55+
$pip = Get-AzPublicIpAddress -ResourceGroupName $rgName -Name "publicIpName"
56+
5057
$rule = New-AzFirewallApplicationRule -Name R1 -Protocol "https:443" -TargetFqdn "*"
5158
$ruleCollection = New-AzFirewallApplicationRuleCollection -Name RC1 -Priority 100 -Rule $rule -ActionType "Allow"
52-
New-AzFirewall -Name "azFw" -ResourceGroupName "rg" -Location centralus -VirtualNetworkName "vnet" -PublicIpName "pip-name" -ApplicationRuleCollection $ruleCollection
59+
New-AzFirewall -Name "azFw" -ResourceGroupName $rgName -Location centralus -VirtualNetworkName $vnet.Name -PublicIpName $pip.Name -ApplicationRuleCollection $ruleCollection
5360
```
5461

5562
This example creates a Firewall which allows all HTTPS traffic on port 443.
@@ -67,17 +74,24 @@ Threat Intel is turned off in this example.
6774

6875
### 4: Create a Firewall with no rules and with Threat Intel in Alert mode
6976
```
70-
New-AzFirewall -Name "azFw" -ResourceGroupName "rg" -Location centralus -VirtualNetworkName "vnet" -PublicIpName "pip-name" -ThreatIntelMode Alert
77+
$rgName = "resourceGroupName"
78+
$vnet = Get-AzVirtualNetwork -ResourceGroupName $rgName -Name "vnet"
79+
$pip = Get-AzPublicIpAddress -ResourceGroupName $rgName -Name "publicIpName"
80+
New-AzFirewall -Name "azFw" -ResourceGroupName $rgName -Location centralus -VirtualNetworkName $vnet.Name -PublicIpName $pip.Name -ThreatIntelMode Alert
7181
```
7282

7383
This example creates a Firewall which blocks all traffic (default behavior) and has Threat Intel running in Alert mode.
7484
This means alerting logs are emitted for malicious traffic before applying the other rules (in this case just the default rule - Deny All)
7585

7686
### 5: Create a Firewall which allows all HTTP traffic on port 8080, but blocks malicious domains identified by Threat Intel
7787
```
88+
$rgName = "resourceGroupName"
89+
$vnet = Get-AzVirtualNetwork -ResourceGroupName $rgName -Name "vnet"
90+
$pip = Get-AzPublicIpAddress -ResourceGroupName $rgName -Name "publicIpName"
91+
7892
$rule = New-AzFirewallApplicationRule -Name R1 -Protocol "http:8080" -TargetFqdn "*"
7993
$ruleCollection = New-AzFirewallApplicationRuleCollection -Name RC1 -Priority 100 -Rule $rule -ActionType "Allow"
80-
New-AzFirewall -Name "azFw" -ResourceGroupName "rg" -Location centralus -VirtualNetworkName "vnet" -PublicIpName "pip-name" -ApplicationRuleCollection $ruleCollection -ThreatIntelMode Deny
94+
New-AzFirewall -Name "azFw" -ResourceGroupName $rgName -Location centralus -VirtualNetworkName $vnet.Name -PublicIpName $pip.Name -ApplicationRuleCollection $ruleCollection -ThreatIntelMode Deny
8195
```
8296

8397
This example creates a Firewall which allows all HTTP traffic on port 8080 unless it is considered malicious by Threat Intel.

src/Network/Network/help/Remove-AzFirewall.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,6 @@ Are you sure you want to remove resource 'azFw'
3535

3636
This example creates a Firewall and then deletes it. To suppress the prompt when deleting the Firewall, use the -Force flag.
3737

38-
### 2: Deallocate the Firewall, then delete the Firewall
39-
```
40-
$firewall=Get-AzFirewall -ResourceGroupName rgName -Name azFw
41-
$firewall.Deallocate()
42-
Remove-AzFirewall -ResourceGroupName rgName -Name azFw
43-
Confirm
44-
Are you sure you want to remove resource 'azFw'
45-
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): y
46-
```
47-
48-
This example retrieves a Firewall, deallocates the firewall, and then deletes the firewall. The Deallocate command removes the running
49-
service but preserves the firewall's configuration. If user wants to start the service again, the Allocate method should be called on the firewall.
50-
To suppress the prompt when deleting the Firewall, use the -Force flag.
51-
5238
## PARAMETERS
5339

5440
### -AsJob

src/Network/Network/help/Set-AzFirewall.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,24 @@ Set-AzFirewall -Firewall $azFw
6262
This example updates the Threat Intel operation mode of Azure Firewall "AzureFirewall" in resource group "rg".
6363
Without the Set-AzFirewall command, all operations performed on the local $azFw object are not reflected on the server.
6464

65+
### 4: Deallocate and allocate the Firewall
66+
```
67+
$firewall=Get-AzFirewall -ResourceGroupName rgName -Name azFw
68+
$firewall.Deallocate()
69+
$firewall | Set-AzFirewall
70+
71+
$vnet = Get-AzVirtualNetwork -ResourceGroupName rgName -Name anotherVNetName
72+
$pip = Get-AzPublicIpAddress - ResourceGroupName rgName -Name publicIpName
73+
$firewall.Allocate($vnet, $pip)
74+
$firewall | Set-AzFirewall
75+
```
76+
77+
This example retrieves a Firewall, deallocates the firewall, and saves it. The Deallocate command removes the running
78+
service but preserves the firewall's configuration. For changes to be reflected in cloud, Set-AzFirewall must be called.
79+
If user wants to start the service again, the Allocate method should be called on the firewall.
80+
The new VNet and Public IP must be in the same resource group as the Firewall. Again, for changes to be reflected in cloud,
81+
Set-AzFirewall must be called.
82+
6583
## PARAMETERS
6684

6785
### -AsJob

0 commit comments

Comments
 (0)