Detection: SQL Server Role Assignment Created or Updated
Overview
Detect when a role assignment in an Azure SQL server or database was updated. Role assignments control access permissions, and changes can impact the security and functionality of SQL resources. Monitoring these updates ensures proper access governance and prevents unauthorized modifications.
References:
Usage
Run the detection in your terminal:
powerpipe detection run azure_activity_log_detections.detection.sql_server_role_assignment_created_or_updatedSnapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe detection run azure_activity_log_detections.detection.sql_server_role_assignment_created_or_updated --shareSQL
This detection uses a named query:
select  tp_timestamp as timestamp,operation_name as operation,resource_id as resource,caller as actor,tp_index::varchar as subscription_id,resource_group_name as resource_group,tp_id as source_id,status as event_status,*
from  azure_activity_logwhere  operation_name = 'Microsoft.Authorization/roleAssignments/write'  and resource_type = 'Microsoft.Sql/servers'  and status = 'Succeeded'
order by  timestamp desc;