Control: Long-term geo-redundant backup should be enabled for Azure SQL Databases
Description
This policy audits any Azure SQL Database with long-term geo-redundant backup not enabled.
Usage
Run the control in your terminal:
powerpipe control run azure_compliance.control.sql_database_long_term_geo_redundant_backup_enabledSnapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run azure_compliance.control.sql_database_long_term_geo_redundant_backup_enabled --shareSQL
This control uses a named query:
select  s.database_id resource,  case    when retention_policy_property ->> 'monthlyRetention' <> 'PT0S'      or retention_policy_property ->> 'weeklyRetention' <> 'PT0S'      or retention_policy_property ->> 'yearlyRetention' <> 'PT0S'      then 'ok'      else 'alarm'  end as status,  case    when retention_policy_property ->> 'monthlyRetention' <> 'PT0S'      or retention_policy_property ->> 'weeklyRetention' <> 'PT0S'      or retention_policy_property ->> 'yearlyRetention' <> 'PT0S'      then s.title || ' long-term geo-redundant backup enabled.'      else s.title || ' long-term geo-redundant backup disabled.'  end as reason    , s.resource_group as resource_group  , sub.display_name as subscriptionfrom  azure_sql_database s  left join azure_subscription sub on sub.subscription_id = s.subscription_idwhere  s.name <> 'master';