turbot/steampipe-mod-azure-compliance

Control: Vulnerability assessment should be enabled on SQL Managed Instance

Description

Audit each SQL Managed Instance which doesn't have recurring vulnerability assessment scans enabled. Vulnerability assessment can discover, track, and help you remediate potential database vulnerabilities.

Usage

Run the control in your terminal:

powerpipe control run azure_compliance.control.mssql_managed_instance_vulnerability_assessment_enabled

Snapshot and share results via Turbot Pipes:

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

SQL

This control uses a named query:

with vulnerability_assessments as (
select
distinct i.id as id
from
azure_mssql_managed_instance as i,
jsonb_array_elements(vulnerability_assessments) a
where
a -> 'recurringScans' ->> 'isEnabled' = 'true'
and a ->> 'name' = 'Default'
)
select
s.id as resource,
case
when a.id is not null then 'ok'
else 'alarm'
end as status,
case
when a.id is not null then s.title || ' vulnerability assessment enabled.'
else s.title || ' vulnerability assessment disabled.'
end as reason
, s.resource_group as resource_group
, sub.display_name as subscription
from
azure_mssql_managed_instance as s
left join vulnerability_assessments as a on s.id = a.id,
azure_subscription as sub
where
sub.subscription_id = s.subscription_id;

Tags