Lesson 4 of 4 Securing Storage Accounts

Implementing Defender for Storage

This lesson explains what Defender for Storage detects, how it is enabled, and how to automate a response.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe the features of the plan.
  • Explain how malware scanning works and is limited.
  • Enable the plan at subscription level.
  • Describe an automated quarantine design.

What the plan detects

Network rules and authorization limit who can reach an account, but neither detects a legitimate-looking credential being misused, nor a malicious file uploaded by an authorized client. Defender for Storage adds that detection. It works with no agent, it does not read content for activity monitoring, and it has no effect on latency. The following table lists its main features.

FeatureWhat it doesCost
Activity monitoringAnalyses data and control plane logs for suspicious patternsPer storage account
Sensitive data threat detectionRaises the priority of alerts on accounts that hold sensitive dataNo additional cost
Malware scanningScans uploaded blobs for malwarePer gigabyte scanned
Hash reputation analysisChecks uploads against known malware hashesIncluded

Activity monitoring alerts on patterns such as access from a Tor exit node, access from an unusual location, an unusual amount of data extracted, the enumeration of containers, and suspicious changes to permissions, such as making a container public.

Select all that apply

Activity monitoring alerts

Exam skills 2.1.3

Identify the patterns that Defender for Storage activity monitoring alerts on.

Log in to try this activity Interactive activities are free with an account.

Malware scanning

Consider a website on which customers upload files that staff later open. An attacker can upload a malicious document, and internal users would then open it. Malware scanning handles this by scanning each new or modified blob, near real time, with Microsoft Defender Antivirus technology.

The scan runs in Microsoft's infrastructure, in the same region as the account. Results are written to a blob index tag and can also go to Defender for Cloud alerts, Event Grid and Log Analytics. To control cost, a cap applies: by default 10,000 GB of scanned data each month per storage account, configurable at subscription or account level. If an account reaches the cap, scanning stops for that period, so a scenario with heavy uploads needs a suitable value. There is also an on-demand option for existing blobs.

The following diagram follows an uploaded blob through malware scanning.

Malware scanning in Defender for Storage. Each new or modified blob is scanned near real time with Microsoft Defender Antivirus technology in Microsoft's infrastructure, in the account's region. The result is written to a blob index tag and can also go to Defender for Cloud alerts, Event Grid and Log Analytics, where automation can quarantine or delete a malicious file. A monthly cap, 10,000 GB per account by default, controls cost; scanning stops for the period when it is reached.
The tag records the result; automation acts on it.
True or false

Malware scanning

Exam skills 2.1.3

Check how malware scanning works and is limited.

Log in to try this activity Interactive activities are free with an account.

Sensitive data threat detection

An alert about data in a test account differs greatly from one about customer records. Sensitive data threat detection uses Sensitive Data Discovery to determine which accounts contain sensitive information, and it uses that information to raise the severity of alerts. It adds no cost, and it can be enabled or disabled separately. It helps analysts decide which alerts to look at first.

Enabling the plan

Microsoft recommends enabling the plan at subscription level, so that existing and future accounts are protected automatically. It can be set on a single account, or excluded from one, and Azure Policy can enforce it. The older classic plan must be migrated, since malware scanning is available only on the current plan, which is priced per storage account.

Enable the plan in Environment settings, on the Defender plans page. Open Settings for the Storage plan to turn malware scanning on and to set its cap. The following command is an equivalent, with the sub-plan and extensions named explicitly.

az security pricing create --name StorageAccounts --tier Standard --subplan DefenderForStorageV2 \
  --extensions name=OnUploadMalwareScanning isEnabled=True additionalExtensionProperties='{"CapGBPerMonthPerStorageAccount":"10000"}' \
  --extensions name=SensitiveDataDiscovery isEnabled=True

Automating the response

A malware finding needs an action, and manual response is too slow if a file might be opened minutes later. Defender for Storage can send scan results to Event Grid, which starts an automated process. A common design is a quarantine: new uploads land in a holding container, and a function moves clean files on and bad files aside.

  1. Upload

    A client writes a blob to a holding container.

  2. Scan

    Defender for Storage scans it and publishes the result.

  3. Route

    Event Grid sends the result to an Azure Function or Logic App.

  4. Act

    Clean files move to the production container, and malicious ones move to quarantine or are deleted.

  5. Record

    An alert appears in Defender for Cloud and flows to Microsoft Sentinel for investigation.

Applications can also read the index tag before opening a file. An ABAC condition can go further, blocking reads of any blob that does not carry the tag for a clean result.

Put in order

A quarantine pipeline

Exam skills 2.1.3

Put the stages of an automated malware response in order.

Log in to try this activity Interactive activities are free with an account.
Worked example

Blocking malicious uploads

A customer portal stores uploaded files in Azure Blob Storage, and staff download them later. The company must detect malware at upload and must stop staff from opening infected files. It needs to control the cost of the scanning.

Enable the current Defender for Storage plan with malware scanning, and set a monthly cap per account that matches the expected volume. Then use Event Grid to run a function that moves infected files to a quarantine container, or use a condition based on the scan result's index tag, so that staff can reach only clean files.

Activity monitoring alone would not inspect uploaded files. Azure Storage firewall rules limit networks and do not examine content. The classic plan does not include malware scanning. A custom script on a VM that scans blobs would work, but it would add operational effort that the service already removes.

Check yourself

What happens when an account reaches its malware scanning cap?

Show answer

Scanning stops for the rest of that period, so uploads go unscanned until the cap resets.

Exam Tips

Remember for the exam

  • Malware scanning is priced per gigabyte, with a default cap of 10,000 GB per account per month.
  • Sensitive data threat detection has no additional cost.
  • Enable at subscription level to cover new accounts.
  • Use Event Grid for automated response to scan results.