Creating a new firewall with PowerShell
Alternatively, we can deploy Azure Firewall using PowerShell. This method is especially useful when services are part of a large deployment or any deployment that needs to be automated.
How to do it...
There are several steps that need to be executed in order to create a new firewall with Azure PowerShell:
- First, we define the parameters:
$RG="Packt-Networking-Script" $Location="West Europe" $VNetName = "Packt-Script" $AzFwIpName = "AzFW-Public-IP" $AzFwname = "AzFw-Script"
- Then, we need to create a separate subnet for Azure Firewall:
$vnet = Get-AzVirtualNetwork -ResourceGroupName $RG ' -Name $VnetName Add-AzVirtualNetworkSubnetConfig -Name AzureFirewallSubnet ' -VirtualNetwork $vnet ' -AddressPrefix 10.11.3.0/24 Set-AzVirtualNetwork -VirtualNetwork $vnet
- Next, we need to create a public IP address for Azure Firewall:
$AzFwIp = New-AzPublicIpAddress -Name ...