Configuring a new allow rule
If we want to allow specific traffic, we must create an allow rule. Rules are applied based on priority level, so a rule will be applied only when there is no other rule with higher priority.
Getting ready
Open the PowerShell console and make sure you are connected to your Azure subscription.
How to do it...
In order to create a new allow rule in Azure Firewall, execute the following command:
$RG="Packt-Networking-Script" $Location="West Europe" $Azfw = Get-AzFirewall -ResourceGroupName $RG $Rule = New-AzFirewallApplicationRule -Name Rule1 -Protocol "http:80","https:443" -TargetFqdn "*packt.com" $RuleCollection = New-AzFirewallApplicationRuleCollection -Name RuleCollection1 -Priority 100 -Rule $Rule -ActionType "Allow" $Azfw.ApplicationRuleCollections = $RuleCollection Set-AzFirewall -AzureFirewall $Azfw
How it works...
An allow rule in Azure Firewall will whitelist specific...