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.
Terraform template
To enable and configure Defender for Storage at the subscription level by using Terraform, you can use the following code snippet:
resource "azurerm_security_center_subscription_pricing" "DefenderForStorage" {
tier = "Standard"
resource_type = "StorageAccounts"
subplan = "DefenderForStorageV2"
extension {
name = "OnUploadMalwareScanning"
additional_extension_properties = {
CapGBPerMonthPerStorageAccount = "10000"
BlobScanResultsOptions = "BlobIndexTags"
}
}
extension {
name = "SensitiveDataDiscovery"
}
}
By customizing this code, you can:
- Modify the monthly cap for malware scanning: Adjust the
CapGBPerMonthPerStorageAccountparameter 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: Remove the corresponding extension block from the Terraform code.
- Disable the entire Defender for Storage plan: Set the
tierproperty value to"Free", and remove thesubPlanandextensionproperties.
To learn more about the azurerm_security_center_subscription_pricing resource, refer to the its Terraform documentation. You can also find comprehensive details on the Terraform provider for Azure in the Terraform AzureRM documentation.
Bicep template
To enable and configure Defender for Storage at the subscription level by using Bicep, make sure your target scope is set to subscription. Add the following code to your Bicep template:
targetScope = 'subscription'
resource StorageAccounts 'Microsoft.Security/pricings@2023-01-01' = {
name: 'StorageAccounts'
properties: {
pricingTier: 'Standard'
subPlan: 'DefenderForStorageV2'
extensions: [
{
name: 'OnUploadMalwareScanning'
isEnabled: 'True'
additionalExtensionProperties: {
CapGBPerMonthPerStorageAccount: '10000'
BlobScanResultsOptions: 'BlobIndexTags'
}
}
{
name: 'SensitiveDataDiscovery'
isEnabled: 'True'
}
]
}
}
By customizing this code, you can:
- Modify the monthly cap for malware scanning: Adjust the
CapGBPerMonthPerStorageAccountparameter 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
isEnabledvalue toFalseunderSensitiveDataDiscovery. - Disable the entire Defender for Storage plan: Set the
pricingTierproperty value toFree, and remove thesubPlanandextensionsproperties.
Learn more about the Bicep template in the Microsoft.Security pricing documentation.
Azure Resource Manager template
To enable and configure Defender for Storage at the subscription level by using an Azure Resource Manager template (ARM template), add this JSON snippet to the resources section of your ARM template:
{
"type": "Microsoft.Security/pricings",
"apiVersion": "2023-01-01",
"name": "StorageAccounts",
"properties": {
"pricingTier": "Standard",
"subPlan": "DefenderForStorageV2",
"extensions": [
{
"name": "OnUploadMalwareScanning",
"isEnabled": "True",
"additionalExtensionProperties": {
"CapGBPerMonthPerStorageAccount": "10000",
"BlobScanResultsOptions": "BlobIndexTags"
}
},
{
"name": "SensitiveDataDiscovery",
"isEnabled": "True"
}
]
}
}
By customizing this code, you can:
- Modify the monthly cap for malware scanning: Adjust the
CapGBPerMonthPerStorageAccountparameter 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
isEnabledvalue toFalseunderSensitiveDataDiscovery. - Disable the entire Defender for Storage plan: Set the
pricingTierproperty value toFree, and remove thesubPlanandextensionproperties.
Learn more about the ARM template in the Microsoft.Security pricing documentation.
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.