turbot/steampipe-mod-azure-compliance

Control: 2.1 Ensure that Azure Defender is set to On for Servers

Description

Enabling Azure Defender threat detection for Server, provides threat intelligence, anomaly detection, and behavior analytics in the Azure Security Center.

Remediation

From Console

Perform the following action to check Azure Defender is set to On for Servers:

  1. Login to Azure console and navigate to Security Center.
  2. Select Pricing & settings blade under Management.
  3. Click on the subscription name, Azure Defender plans blade got selected.
  4. For the Servers resource type Plan should be set to On.

Perform the following action to enable Azure Defender for Servers:

  1. Login to Azure console and navigate to Security Center.
  2. Select Pricing & settings blade under Management.
  3. Click on the subscription name, Azure Defender plans blade got selected.
  4. For the Servers resource type Plan set it to On.

From Command Line

Command to enable Azure defender for servers

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/pr icings/VirtualMachines?api-version=2018-06-01 -d@"input.json"'

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

{
"id":"/subscriptions/<Your_Subscription_Id>/providers/Microsoft.Security/pricings/ VirtualMachines",
"name":"VirtualMachines",
"type":"Microsoft.Security/pricings",
"properties":{
"pricingTier":"Standard"
}
}

Usage

Run the control in your terminal:

powerpipe control run azure_compliance.control.cis_v130_2_1

Snapshot and share results via Turbot Pipes:

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

SQL

This control uses a named query:

select
sub_pricing.id as resource,
case
when pricing_tier = 'Standard' then 'ok'
else 'alarm'
end as status,
case
when pricing_tier = 'Standard' then 'Azure Defender on for Servers.'
else 'Azure Defender off for Servers.'
end as reason
, sub.display_name as subscription
from
azure_security_center_subscription_pricing sub_pricing
right join azure_subscription sub on sub_pricing.subscription_id = sub.subscription_id
where
name = 'VirtualMachines';

Tags