Skip to content

Commit d10824c

Browse files
authored
Merge pull request #201303 from igorpag/igorpag-fwman-patch1
Igorpag fwman patch1
2 parents a436e36 + 1754b3f commit d10824c

File tree

2 files changed

+53
-2
lines changed

2 files changed

+53
-2
lines changed
48.5 KB
Loading

articles/firewall-manager/secure-cloud-network-powershell.md

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ In this tutorial, you learn how to:
2121
> * Deploy Azure Firewall and configure custom routing
2222
> * Test connectivity
2323
24+
> [!IMPORTANT]
25+
> A Virtual WAN is a collection of hubs and services made available inside the hub. You can deploy as many Virtual WANs that you need. In a Virtual WAN hub, there are multiple services such as VPN, ExpressRoute, and so on. Each of these services is automatically deployed across **Availability Zones** *except* Azure Firewall, if the region supports Availability Zones. To upgrade an existing Azure Virtual WAN Hub to a Secure Hub and have the Azure Firewall use Availability Zones, you must use Azure PowerShell, as described later in this article.
26+
2427
## Prerequisites
2528

2629
- If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
@@ -29,6 +32,8 @@ In this tutorial, you learn how to:
2932

3033
This tutorial requires that you run Azure PowerShell locally on PowerShell 7. To install PowerShell 7, see [Migrating from Windows PowerShell 5.1 to PowerShell 7](/powershell/scripting/install/migrating-from-windows-powershell-51-to-powershell-7?view=powershell-7&preserve-view=true).
3134

35+
- "Az.Network" module version must be 4.17.0 or higher.
36+
3237
## Sign in to Azure
3338

3439
```azurepowershell
@@ -46,6 +51,8 @@ $RG = "vwan-rg"
4651
$Location = "westeurope"
4752
$VwanName = "vwan"
4853
$HubName = "hub1"
54+
$FirewallTier = "Standard" # or "Premium"
55+
4956
# Create Resource Group, Virtual WAN and Virtual Hub
5057
New-AzResourceGroup -Name $RG -Location $Location
5158
$Vwan = New-AzVirtualWan -Name $VwanName -ResourceGroupName $RG -Location $Location -AllowVnetToVnetTraffic -AllowBranchToBranchTraffic -VirtualWANType "Standard"
@@ -74,9 +81,13 @@ $AzFWHubIPs = New-AzFirewallHubIpAddress -PublicIP $AzFWPIPs
7481
# New Firewall
7582
$AzFW = New-AzFirewall -Name "azfw1" -ResourceGroupName $RG -Location $Location `
7683
-VirtualHubId $Hub.Id -FirewallPolicyId $FWPolicy.Id `
77-
-Sku AZFW_Hub -HubIPAddress $AzFWHubIPs
84+
-SkuName "AZFW_Hub" -HubIPAddress $AzFWHubIPs `
85+
-SkuTier $FirewallTier
7886
```
7987

88+
> [!NOTE]
89+
> The following Firewall creation command does **not** use Availability Zones. If you want to use this feature, an additional parameter **-Zone** is required. An example is provided in the upgrade section at the end of this article.
90+
8091
Enabling logging from the Azure Firewall to Azure Monitor is optional, but in this example you use the Firewall logs to prove that traffic is traversing the firewall:
8192

8293
```azurepowershell
@@ -199,7 +210,7 @@ Get-AzEffectiveRouteTable -ResourceGroupName $RG -NetworkInterfaceName $NIC2.Nam
199210
Now generate traffic from one Virtual Machine to the other, and verify that it's dropped in the Azure Firewall. In the following SSH commands you need to accept the virtual machines fingerprints, and provide the password that you defined when you created the virtual machines. In this example, you're going to send five ICMP echo request packets from the virtual machine in spoke1 to spoke2, plus a TCP connection attempt on port 22 using the Linux utility `nc` (with the `-vz` flags it just sends a connection request and shows the result). You should see the ping failing, and the TCP connection attempt on port 22 succeeding, since it's allowed by the network rule you configured previously:
200211

201212
```azurepowershell
202-
# Connect to one VM and ping the other. It shouldnt work, because the firewall should drop the traffic, since no rule for ICMP is configured
213+
# Connect to one VM and ping the other. It should not work, because the firewall should drop the traffic, since no rule for ICMP is configured
203214
ssh $AzFWPublicAddress -p 10001 -l $VMLocalAdminUser "ping $Spoke2VMPrivateIP -c 5"
204215
# Connect to one VM and send a TCP request on port 22 to the other. It should work, because the firewall is configured to allow SSH traffic (port 22)
205216
ssh $AzFWPublicAddress -p 10001 -l $VMLocalAdminUser "nc -vz $Spoke2VMPrivateIP 22"
@@ -272,6 +283,46 @@ To delete the test environment, you can remove the resource group with all conta
272283
Remove-AzResourceGroup -Name $RG
273284
```
274285

286+
## Upgrade an existing Hub with Availability Zones
287+
288+
The previous procedure uses Azure PowerShell to create a **new** Azure Virtual WAN Hub, and then immediately converts it to a Secured Hub using Azure Firewall.
289+
A similar approach can be applied to an **existing** Azure Virtual WAN Hub. Firewall Manager can be also used for the conversion, but it isn't possible to deploy Azure Firewall across Availability Zones without a script-based approach.
290+
You can use the following code snippet to convert an existing Azure Virtual WAN Hub to a Secured Hub, using an Azure Firewall deployed across all three Availability Zones.
291+
292+
```azurepowershell
293+
# Variable definition
294+
$RG = "vwan-rg"
295+
$Location = "westeurope"
296+
$VwanName = "vwan"
297+
$HubName = "hub1"
298+
$FirewallName = "azfw1"
299+
$FirewallTier = "Standard" # or "Premium"
300+
$FirewallPolicyName = "VwanFwPolicy"
301+
302+
# Get references to vWAN and vWAN Hub to convert #
303+
$Vwan = Get-AzVirtualWan -ResourceGroupName $RG -Name $VwanName
304+
$Hub = Get-AzVirtualHub -ResourceGroupName $RG -Name $HubName
305+
306+
# Create a new Firewall Policy #
307+
$FWPolicy = New-AzFirewallPolicy -Name $FirewallPolicyName -ResourceGroupName $RG -Location $Location
308+
309+
# Create a new Firewall Public IP #
310+
$AzFWPIPs = New-AzFirewallHubPublicIpAddress -Count 1
311+
$AzFWHubIPs = New-AzFirewallHubIpAddress -PublicIP $AzFWPIPs
312+
313+
# Create Firewall instance #
314+
$AzFW = New-AzFirewall -Name $FirewallName -ResourceGroupName $RG -Location $Location `
315+
-VirtualHubId $Hub.Id -FirewallPolicyId $FWPolicy.Id `
316+
-SkuName "AZFW_Hub" -HubIPAddress $AzFWHubIPs `
317+
-SkuTier $FirewallTier `
318+
-Zone 1,2,3
319+
```
320+
After you run this script, Availability Zones should appear in the secured hub properties as shown in the following screenshot:
321+
322+
:::image type="content" source="./media/secure-cloud-network/vwan-firewall-hub-az-correct7.png" alt-text="Screenshot of Secured virtual hub availability zones." lightbox="./media/secure-cloud-network/vwan-firewall-hub-az-correct7.png":::
323+
324+
After the Azure Firewall is deployed, a configuration procedure must be completed as described in the previous *Deploy Azure Firewall and configure custom routing* section.
325+
275326
## Next steps
276327

277328
> [!div class="nextstepaction"]

0 commit comments

Comments
 (0)