Creating an Azure firewall policy using PowerShell
You can create an Azure firewall policy and rules using different tools: Azure Firewall Manager, PowerShell, CLI, and REST API. In this recipe, you will create an Azure firewall policy and policy rules using PowerShell.
Getting ready
Open your preferred PowerShell tool – this could be Visual Studio Code, Windows PowerShell ISE, the PowerShell console, or something else.
Sign in to your Azure account: Connect-AzAccount
.
How to do it…
To create an Azure firewall policy and policy rules using PowerShell, complete the following steps:
- Define firewall policy resources:
$RGName="Firewall" $Location="West Europe" $fwPolicyName="FW-policy" $netCollName="NetworkCollectionGroup" $netRuleName="AllowGoogleDNS" $appCollName="AppCollectionGroup" $appRuleName="Allow-Packt"
- Create a resource group:
New-AzResourceGroup -Name $RGName -Location...