Control: 2.1.6 Ensure That Microsoft Defender for Azure Cosmos DB Is Set To 'On'
Description
Microsoft Defender for Azure Cosmos DB scans all incoming network requests for threats to your Azure Cosmos DB resources.
In scanning Azure Cosmos DB requests within a subscription, requests are compared to a heuristic list of potential security threats. These threats could be a result of a security breach within your services, thus scanning for them could prevent a potential security threat from being introduced.
Remediation
From Azure Portal
- Go to 
Microsoft Defender for Cloud. - Select 
Environment Settingsblade. - Click on the subscription name.
 - Select the 
Defender plansblade. - On the 
Databaserow click onSelect types >. - Set the radio button next to 
Azure Cosmos DBtoOn. - Click 
Continue. - Click 
Save. 
From Azure CLI
Run the following command:
az security pricing create -n 'CosmosDbs' --tier 'standard'
From Powershell
Use the below command to enable Standard pricing tier for Azure Cosmos DB
Set-AzSecurityPricing -Name 'CosmosDbs' -PricingTier 'Standard
Default Value
By default, Microsoft Defender for Azure Cosmos DB is not enabled.
Usage
Run the control in your terminal:
powerpipe control run azure_compliance.control.cis_v210_2_1_6Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run azure_compliance.control.cis_v210_2_1_6 --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 Cosmos DB.'    else 'Azure Defender off for Cosmos DB.'  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 = 'CosmosDbs';