01 Run account list command (Windows/macOS/Linux) with custom output filters to list the IDs of the cloud subscriptions available in your Azure cloud account:
az account list
--query '[*].id'
02 The command output should return the requested subscription identifiers (IDs):
[
"abcdabcd-1234-abcd-1234-abcdabcdabcd",
"abcd1234-abcd-1234-abcd-abcd1234abcd"
]
03 Run account set command (Windows/macOS/Linux) with the ID of the Azure cloud subscription that you want to examine as the identifier parameter to set the selected subscription to be the current active subscription (the command does not produce an output):
az account set
--subscription abcdabcd-1234-abcd-1234-abcdabcdabcd
04 Run network application-gateway list command (Windows/macOS/Linux) with custom output filters to list the ID of each Azure Application Gateway available in the selected subscription:
az network application-gateway list
--query '[*].id'
05 The command output should return the requested Application Gateway IDs:
[
"/subscriptions/abcdabcd-1234-abcd-1234-abcdabcdabcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.Network/applicationGateways/cc-project5-application-gateway",
"/subscriptions/abcdabcd-1234-abcd-1234-abcdabcdabcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.Network/applicationGateways/cc-prod-stack-application-gateway"
]
06 Run network application-gateway show command (Windows/macOS/Linux) with the name of the Azure Application Gateway that you want to examine as the identifier parameter and custom output filters to describe the ID of the WAF security policy associated with the selected Application Gateway:
az network application-gateway show
--ids "/subscriptions/abcdabcd-1234-abcd-1234-abcdabcdabcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.Network/applicationGateways/cc-project5-application-gateway"
--query '{firewallPolicy:firewallPolicy.id}'
07 The command output should return the requested WAF policy ID. If the network application-gateway show command output returns null for "firewallPolicy", there are no WAF policies associated with your resource, therefore, Azure Web Application Firewall is not enabled for the selected Application Gateway. If the ID of the WAF policy is returned, as shown in the example below, continue the Audit process with the next step:
{
"firewallPolicy": "/subscriptions/abcdabcd-1234-abcd-1234-abcdabcdabcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/cc-app-gateway-waf-policy"
}
08 Run network application-gateway waf-policy show command (Windows/macOS/Linux) to determine if Bot Protection is enabled for the associated Web Application Firewall (WAF) policy. For --name, use the WAF policy name included in the resource ID returned in the previous step (i.e., "/subscriptions/\<subscription-id\>/resourceGroups/\<resource-group\>/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/\<waf-policy-name\>"):
az network application-gateway waf-policy show
--name cc-app-gateway-waf-policy
--resource-group cloud-shell-storage-westeurope
--query "managedRules.managedRuleSets"
09 The command output should return the managed rule sets configured for the selected WAF policy:
[
{
"ruleGroupOverrides": [],
"ruleSetType": "OWASP",
"ruleSetVersion": "3.2"
},
{
"ruleGroupOverrides": [],
"ruleSetType": "Microsoft_BotManagerRuleSet",
"ruleSetVersion": "1.1"
}
]
Ensure that the network application-gateway waf-policy show command output returns a managed rule set with "ruleSetType" set to "Microsoft_BotManagerRuleSet", and that no "ruleGroupOverrides" for "ruleGroupName": "BadBots" with "state" set to "Disabled", as shown in the example above. If the command output does not return a rule set with "ruleSetType" set to "Microsoft_BotManagerRuleSet" or the "ruleGroupOverrides" has "ruleGroupName": "BadBots" with "state" set to "Disabled", as shown in the example below, Bot Protection is not enabled for the WAF policy associated with the selected Azure Application Gateway:
[
{
"ruleGroupOverrides": [],
"ruleSetType": "OWASP",
"ruleSetVersion": "3.2"
},
{
"ruleGroupOverrides": [
{
"ruleGroupName": "BadBots",
"rules": [
{
"action": "Block",
"ruleId": "100100",
"state": "Disabled"
}
]
}
],
"ruleSetType": "Microsoft_BotManagerRuleSet",
"ruleSetVersion": "1.1"
}
]