Control: Ensure server parameter 'audit_log_events' has 'CONNECTION' set for MySQL flexible Server
Description
Set audit_log_enabled to include CONNECTION on MySQL flexible servers.
Usage
Run the control in your terminal:
powerpipe control run azure_compliance.control.mysql_flexible_server_audit_logging_events_connection_set
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run azure_compliance.control.mysql_flexible_server_audit_logging_events_connection_set --share
SQL
This control uses a named query:
with audit_log_events as( select id from azure_mysql_flexible_server, jsonb_array_elements(flexible_server_configurations) as config where config ->> 'Name' = 'audit_log_events' and config -> 'ConfigurationProperties' ->> 'value' = 'CONNECTION')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 || ' server parameter audit_log_events has connection set.' else s.title || ' server parameter audit_log_events connection not set.' end as reason , s.resource_group as resource_group , sub.display_name as subscriptionfrom azure_mysql_flexible_server as s left join audit_log_events as a on s.id = a.id, azure_subscription as subwhere sub.subscription_id = s.subscription_id;