Table: azure_web_application_firewall_policy - Query Azure Web Application Firewall Policies using SQL
Azure Web Application Firewall (WAF) is a service that helps protect your web applications by filtering and monitoring HTTP traffic between a web application and the Internet. The azure_web_application_firewall_policy
table in Steampipe allows you to query information about WAF policies in Azure, including their custom and managed rules, associated application gateways, HTTP listeners, and more.
Table Usage Guide
The azure_web_application_firewall_policy
table enables cloud administrators and security engineers to gather detailed insights into their WAF policies. You can query various aspects of the policies, such as their custom rules, managed rules, provisioning state, and associated application gateways. This table is particularly useful for monitoring the security of web applications, managing WAF policy configurations, and ensuring that your web applications are protected against threats.
Examples
Basic info
Retrieve basic information about your Azure WAF policies, including their name, resource group, and region.
select name, id, resource_group, region, provisioning_statefrom azure_web_application_firewall_policy;
select name, id, resource_group, region, provisioning_statefrom azure_web_application_firewall_policy;
List policies with custom rules
Fetch WAF policies that include custom rules, which can be useful for identifying policies with specific, user-defined security measures.
select name, custom_rulesfrom azure_web_application_firewall_policywhere custom_rules is not null;
select name, custom_rulesfrom azure_web_application_firewall_policywhere json_extract(custom_rules, '$[0]') is not null;
List policies by provisioning state
Identify WAF policies based on their provisioning state, such as those that are currently updating or have failed.
select name, provisioning_state, regionfrom azure_web_application_firewall_policywhere provisioning_state = 'ProvisioningStateUpdating';
select name, provisioning_state, regionfrom azure_web_application_firewall_policywhere provisioning_state = 'ProvisioningStateUpdating';
Get managed rules for each policy
Retrieve the managed rules associated with each WAF policy to understand the built-in protections that are applied to your web applications.
select name, managed_rules -> 'Exclusions' as exclusions, managed_rules -> 'ManagedRuleSets' as managed_rule_setsfrom azure_web_application_firewall_policy;
select name, json_extract(managed_rules, '$.Exclusions') as exclusions, json_extract(managed_rules, '$.ManagedRuleSets') as managed_rule_setsfrom azure_web_application_firewall_policy;
List policies with associated application gateways
Identify WAF policies that are linked to specific application gateways, which can help in managing and securing web traffic.
select name, application_gatewaysfrom azure_web_application_firewall_policywhere application_gateways is not null;
select name, application_gatewaysfrom azure_web_application_firewall_policywhere json_extract(application_gateways, '$[0]') is not null;
List policies with HTTP listeners
Fetch WAF policies that are associated with specific HTTP listeners, which can be important for understanding how traffic is being monitored and filtered.
select name, http_listenersfrom azure_web_application_firewall_policywhere http_listeners is not null;
select name, http_listenersfrom azure_web_application_firewall_policywhere json_extract(http_listeners, '$[0]') is not null;
Get application gateway details that are associated with the firewall policy
Get application gateway associated with WAF policies and configurations
select a.name as application_name, a.provisioning_state as application_provisioning_state, a.enable_fips, a.autoscale_configuration, p.name as policy_name, p.policy_settingsfrom azure_application_gateway as a join azure_web_application_firewall_policy as p on (a.firewall_policy ->> 'id') = p.id;
select a.name as application_name, a.provisioning_state as application_provisioning_state, a.enable_fips, a.autoscale_configuration, p.name as policy_name, p.policy_settingsfrom azure_application_gateway as a join azure_web_application_firewall_policy as p on json_extract(a.firewall_policy, '$.id') = p.id;
Schema for azure_web_application_firewall_policy
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
akas | jsonb | Array of globally unique identifier strings (also known as) for the resource. | |
application_gateways | jsonb | A collection of references to application gateways. | |
cloud_environment | text | The Azure Cloud Environment. | |
custom_rules | jsonb | The custom rules inside the policy. | |
etag | text | A unique read-only string that changes whenever the resource is updated. | |
http_listeners | jsonb | A collection of references to application gateway http listeners. | |
id | text | Resource ID. | |
managed_rules | jsonb | Describes the managedRules structure. | |
name | text | = | Resource name. |
path_based_rules | jsonb | A collection of references to application gateway path rules. | |
policy_settings | jsonb | The PolicySettings for policy. | |
provisioning_state | text | The provisioning state of the web application firewall policy resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed'. | |
region | text | The Azure region/location in which the resource is located. | |
resource_group | text | = | The resource group which holds this resource. |
resource_state | text | Resource status of the policy. Possible values include: 'WebApplicationFirewallPolicyResourceStateCreating', 'WebApplicationFirewallPolicyResourceStateEnabling', 'WebApplicationFirewallPolicyResourceStateEnabled', 'WebApplicationFirewallPolicyResourceStateDisabling', 'WebApplicationFirewallPolicyResourceStateDisabled', 'WebApplicationFirewallPolicyResourceStateDeleting'. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
subscription_id | text | =, !=, ~~, ~~*, !~~, !~~* | The Azure Subscription ID in which the resource is located. |
tags | jsonb | A map of tags for the resource. | |
title | text | Title of the resource. | |
type | text | Resource type. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- azure
You can pass the configuration to the command with the --config
argument:
steampipe_export_azure --config '<your_config>' azure_web_application_firewall_policy