turbot/steampipe-mod-azure-compliance

Control: Ensure that Network Security Group Flow Log retention period is 'greater than 90 days'

Description

Network Security Group Flow Logs should be enabled and the retention period is set to greater than or equal to 90 days.

Usage

Run the control in your terminal:

powerpipe control run azure_compliance.control.network_sg_flowlog_retention_period_greater_than_90

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run azure_compliance.control.network_sg_flowlog_retention_period_greater_than_90 --share

SQL

This control uses a named query:

select
sg.id resource,
case
when fl.id is null or not fl.enabled or fl.retention_policy_days < 90 then 'alarm'
else 'ok'
end as status,
case
when fl.id is null or not fl.enabled
then sg.name || ' flowlog not enabled.'
when fl.retention_policy_days < 90
then sg.name || ' flowlog ' || fl.title || ' retention period is less than 90 days.'
else sg.name || ' flowlog ' || fl.title || ' retention period is ' || fl.retention_policy_days || ' days.'
end as reason
, sg.resource_group as resource_group
, sub.display_name as subscription
from
azure_network_security_group sg
left join azure_network_watcher_flow_log fl on sg.id = fl.target_resource_id
join azure_subscription sub on sub.subscription_id = sg.subscription_id;

Tags