Control: Azure Defender for SQL should be enabled for unprotected SQL Managed Instances
Description
Audit each SQL Managed Instance without advanced data security. Turning on Azure Defender enables threat detection for SQL Managed Instance, providing threat intelligence, anomaly detection, and behavior analytics in the Azure Security Center
Usage
Run the control in your terminal:
powerpipe control run terraform_azure_compliance.control.securitycenter_azure_defender_on_for_sqlservervmSnapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run terraform_azure_compliance.control.securitycenter_azure_defender_on_for_sqlservervm --shareSQL
This control uses a named query:
select  address as resource,  case    when (attributes_std ->> 'resource_type') = 'SqlServerVirtualMachines' and (attributes_std ->> 'tier') = 'Standard' then 'ok'    else 'skip'  end status,  split_part(address, '.', 2) || case    when (attributes_std ->> 'resource_type') = 'SqlServerVirtualMachines' and (attributes_std ->> 'tier') = 'Standard' then ' Azure Defender on for SQL servers on machines'    else ' Azure Defender off for SQL servers on machines'  end || '.' reason  , path || ':' || start_linefrom  terraform_resourcewhere  type = 'azurerm_security_center_subscription_pricing';