turbot/steampipe-mod-azure-compliance

Control: 2.11 Ensure That Auto provisioning of 'Log Analytics agent for Azure VMs' is Set to 'On'

Description

Enable automatic provisioning of the monitoring agent to collect security data. When this agent is turned on, Azure Security Center provisions the Microsoft Monitoring Agent on all existing supported Azure virtual machines and any new ones that are created.

The Microsoft Monitoring Agent scans for various security-related configurations and events such as system updates, OS vulnerabilities, endpoint protection, and provides alerts.

Remediation

From Console

Perform the following action to check Defender for Endpoint to access my data is enabled:

  1. Go to Microsoft Defender for Cloud
  2. Click on Environment Settings
  3. Click on a subscription
  4. Click on Auto Provisioning in the left column.
  5. Ensure that Log Analytics agent for Azure VMs is set to On

From Command Line

Use the below command to set Automatic provisioning of monitoring agent to On.

az account get-access-token --query "{subscription:subscription,accessToken:accessToken}" --out tsv | xargs -L1 bash -c 'curl -X PUT -H "Authorization: Bearer $1" -H "Content-Type: application/json" https://management.azure.com/subscriptions/$0/providers/Microsoft.Security/autoProvisioningSettings/default?api-version=2017-08-01-preview -d@"input.json"'

Where input.json contains the request body json data as mentioned below

{
"id":"/subscriptions/<Your_Subscription_Id>/providers/Microsoft.Security/autoProvisioningSettings/default",
"name":"default",
"type":"Microsoft.Security/autoProvisioningSettings",
"properties":{
"autoProvision":"On"
}
}

Usage

Run the control in your terminal:

powerpipe control run azure_compliance.control.cis_v140_2_11

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run azure_compliance.control.cis_v140_2_11 --share

SQL

This control uses a named query:

select
sc_prov.id as resource,
case
when auto_provision = 'On' then 'ok'
else 'alarm'
end as status,
case
when auto_provision = 'On' then 'Automatic provisioning of monitoring agent is on.'
else 'Automatic provisioning of monitoring agent is off.'
end as reason,
sub.display_name as subscription
from
azure_security_center_auto_provisioning sc_prov
right join azure_subscription sub on sc_prov.subscription_id = sub.subscription_id;

Tags