Table: azure_sql_server_database_vulnerability_assessment_scans
This table shows data for Azure SQL Server Database Vulnerability Assessment Scans.
The primary key for this table is id.
Relations
This table depends on azure_sql_server_database_vulnerability_assessments.
Columns
Name | Type |
---|---|
_cq_id | uuid |
_cq_parent_id | uuid |
subscription_id | utf8 |
properties | json |
id (PK) | utf8 |
name | utf8 |
type | utf8 |
Example Queries
These SQL queries are sampled from CloudQuery policies and are compatible with PostgreSQL.
SQL databases should have vulnerability findings resolved
WITH
safe_dbs
AS (
SELECT
s.id AS sql_database_id
FROM
azure_sql_server_database_vulnerability_assessment_scans AS s
JOIN (
SELECT
_cq_id, max((properties->>'endTime')::TIMESTAMP) AS max_dt
FROM
azure_sql_server_database_vulnerability_assessment_scans
GROUP BY
_cq_id
)
AS t ON
s._cq_id = t._cq_id
AND (properties->>'endTime')::TIMESTAMP = t.max_dt
WHERE
(s.properties->>'numberOfFailedSecurityChecks')::INT8 = 0
)
SELECT
'SQL databases should have vulnerability findings resolved' AS title,
s.subscription_id,
d.id,
CASE
WHEN d.id IS NULL THEN 'fail'
ELSE 'pass'
END
FROM
azure_sql_servers AS s
LEFT JOIN azure_sql_server_databases AS d ON s._cq_id = d._cq_parent_id
LEFT JOIN safe_dbs AS sd ON d.id = sd.sql_database_id;