Control: 2.1.8 Ensure That Microsoft Defender for Containers Is Set To 'On'
Description
Turning on Microsoft Defender for Containers enables threat detection for Container Registries including Kubernetes, providing threat intelligence, anomaly detection, and behavior analytics in the Microsoft Defender for Cloud. The following services will be enabled for container instances:
- Defender agent in Azure
 - Azure Policy for Kubernetes
 - Agentless discovery for Kubernetes
 - Agentless container vulnerability assessment
 
Remediation
From Azure Portal
- Go to 
Microsoft Defender for Cloud. - Select 
Environment Settings. - Click on the subscription name.
 - Select 
Defender plans. - Set 
StatustoOnforContainers. - Click 
Save. 
From Azure CLI
(Note: 'ContainerRegistry' has been deprecated and is replaced by 'Containers') Use the below command to enable Standard pricing tier for Containers.
az security pricing create -n 'Containers' --tier 'standard'
From Powershell
(Note: 'ContainerRegistry' has been deprecated and is replaced by 'Containers') Use the below command to enable Standard pricing tier for Containers.
Set-AzSecurityPricing -Name 'Containers' -PricingTier 'Standard'
Default Value
By default, Microsoft Defender for Containers is off.
Usage
Run the control in your terminal:
powerpipe control run azure_compliance.control.cis_v210_2_1_8Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run azure_compliance.control.cis_v210_2_1_8 --shareSQL
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 Container Registry.'    else 'Azure Defender off for Container Registry.'  end as reason    , sub.display_name as subscriptionfrom  azure_security_center_subscription_pricing sub_pricing  right join azure_subscription sub on sub_pricing.subscription_id = sub.subscription_idwhere  name = 'ContainerRegistry';