Configuring a new deny rule
If we want to deny specific traffic, we must create a deny rule. Rules are applied by priority, so this rule will be applied only if there is not a higher-priority rule in effect.
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 deny 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 "*google.com" $RuleCollection = New-AzFirewallApplicationRuleCollection -Name RuleCollection1 -Priority 100 -Rule $Rule -ActionType "Deny" $Azfw.ApplicationRuleCollections = $RuleCollection Set-AzFirewall -AzureFirewall $Azfw
How it works...
The deny rule is the most commonly used option with Azure Firewall...