Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
We recommend that you enable Microsoft Defender for Storage on the subscription level. Doing so helps ensure that all storage accounts currently in the subscription are protected. Protection for storage accounts that you create after enabling Defender for Storage on the subscription level starts up to 24 hours after creation.
Tip
You can always configure specific storage accounts with custom settings that differ from the settings configured at the subscription level. That is, you can override subscription-level settings.
To enable and configure Defender for Storage at the subscription level by using the REST API, create a PUT
request with the following endpoint. Replace the subscriptionId
value in the endpoint URL with your own Azure subscription ID.
PUT
https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/StorageAccounts?api-version=2024-01-01
Add the following request body:
{
"properties": {
"extensions": [
{
"name": "OnUploadMalwareScanning",
"isEnabled": "True",
"additionalExtensionProperties": {
"CapGBPerMonthPerStorageAccount": "10000",
"BlobScanResultsOptions": "BlobIndexTags"/"None"
"AutomatedResponse": "BlobSoftDelete"/"None"
}
},
{
"name": "SensitiveDataDiscovery",
"isEnabled": "True"
}
],
"subPlan": "DefenderForStorageV2",
"pricingTier": "Standard"
}
}
By customizing this code, you can:
- Modify the monthly threshold for malware scanning: Adjust the
CapGBPerMonthPerStorageAccount
parameter to your preferred value. This parameter sets a cap on the maximum data that can be scanned for malware each month, per storage account. If you want to permit unlimited scanning, assign the value-1
. The default limit is 10,000 GB. - Turn off the on-upload malware scanning or sensitive-data threat detection feature: Change the
isEnabled
value toFalse
underSensitiveDataDiscovery
. - Turn off the use of blob index tags: Change the
BlobScanResultsOptions
value toNone
. If you don't set this value, all scan results are published to blob index tags. - Disable the entire Defender for Storage plan: Set the
pricingTier
property value toFree
, and remove thesubPlan
andextensions
properties.
Learn more about updating Defender plans with the REST API in HTTP, Java, Go, and JavaScript.
Tip
You can configure malware scanning to send scanning results to:
- Azure Event Grid custom topic: For near-real-time automatic response based on every scanning result.
- Log Analytics workspace: For storing every scan result in a centralized log repository for compliance and audit.
Learn more on how to set up a response for malware scanning results.