Control: Azure Monitor should collect activity logs from all regions
Description
This policy audits the Azure Monitor log profile which does not export activities from all Azure supported regions including global.
Usage
Run the control in your terminal:
powerpipe control run terraform_azure_compliance.control.monitor_log_profile_enabled_for_all_regions
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run terraform_azure_compliance.control.monitor_log_profile_enabled_for_all_regions --share
SQL
This control uses a named query:
select address as resource, case when (attributes_std -> 'locations') @> '["global", "australiacentral", "australiacentral2", "australiaeast", "australiasoutheast", "brazilsouth", "brazilsoutheast", "canadacentral", "canadaeast", "centralindia", "centralus", "eastasia", "eastus", "eastus2", "francecentral", "francesouth","germanynorth", "germanywestcentral", "japaneast", "japanwest", "jioindiawest", "koreacentral", "koreasouth", "northcentralus", "northeurope", "norwayeast", "norwaywest", "southafricanorth", "southafricawest", "southcentralus", "southeastasia", "southindia", "switzerlandnorth", "switzerlandwest", "uaecentral", "uaenorth", "uksouth", "ukwest", "westcentralus", "westeurope", "westindia", "westus", "westus2", "westus3"]' then 'ok' else 'alarm' end status, split_part(address, '.', 2) || case when (attributes_std -> 'locations') @> '["global", "australiacentral", "australiacentral2", "australiaeast", "australiasoutheast", "brazilsouth", "brazilsoutheast", "canadacentral", "canadaeast", "centralindia", "centralus", "eastasia", "eastus", "eastus2", "francecentral", "francesouth","germanynorth", "germanywestcentral", "japaneast", "japanwest", "jioindiawest", "koreacentral", "koreasouth", "northcentralus", "northeurope", "norwayeast", "norwaywest", "southafricanorth", "southafricawest", "southcentralus", "southeastasia", "southindia", "switzerlandnorth", "switzerlandwest", "uaecentral", "uaenorth", "uksouth", "ukwest", "westcentralus", "westeurope", "westindia", "westus", "westus2", "westus3"]' then ' collect activity logs from all regions' else ' not collect activity logs from all regions' end || '.' reason , path || ':' || start_linefrom terraform_resourcewhere type = 'azurerm_monitor_log_profile';