Skip to content

Commit 51ee9cb

Browse files
author
Igor Pagliai
committed
Upgraded script and added AZ section
1 parent 233c5dd commit 51ee9cb

File tree

1 file changed

+47
-1
lines changed

1 file changed

+47
-1
lines changed

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

Lines changed: 47 additions & 1 deletion
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+
> Virtual WAN is a collection of hubs and services made available inside the hub. The user can have as many Virtual WAN per their need. In a Virtual WAN hub, there are multiple services like VPN, ExpressRoute etc. 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 Secure Hub and have the Azure Firewall leveraging Availability Zones, PowerShell code must be used, as described in this article, see section below.
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 Firewall creation command below will **not** use Availability Zones. If you want to leverage 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
@@ -272,6 +283,41 @@ 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 procedure described above will permit a user to create a brand **new** Azure Virtual WAN Hub, and then immediately convert to a Secured Hub deploying Azure Firewall using a PowerShell script.
289+
A similar approach can be applied to an **existing** Azure Virtual WAN Hub: Firewall Manager can be also used for the conversion, but will not be possible to deploy Azure Firewall across Availability Zones without a script-based approach.
290+
The code snippet required to convert an existing Azure Virtual WAN Hub to a Secured Hub, using an Azure Firewall deployed across all three Availability Zones, is reported below:
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+
275321
## Next steps
276322

277323
> [!div class="nextstepaction"]

0 commit comments

Comments
 (0)