Defender for Storage Malware Scanning Design
Purpose
Define the event-driven malware scanning integration between Microsoft Defender for Storage and Fluxx using Event Grid and Azure Service Bus
This document defines:
- Malware scanning architecture
- Event routing model
- File Intake responsibilities
- Correlation strategy
- Scan result persistence
- Sequence of operations
Architectural Overview
Key Characteristics
- Hierarchical Namespace (HNS) is enabled on the storage account
- Microsoft Defender for Storage performs asynchronous malware scanning
- Malware scan results are emitted as security events
- Event Grid routes scan result events to Azure Service Bus
- File Intake consumes scan result events and updates the database
End-to-End Flow
- A file is uploaded via File Intake
- The file is persisted to Blob Storage
- Defender for Storage scans the blob asynchronously
- Defender emits a malware scanning security event
- Event Grid receives the security event
- Event Grid publishes the event to a Service Bus topic
- File Intake consumes the Service Bus message
- File Intake updates the file record with the scan result
- Malicious files are quarantined via soft delete
Event Delivery Model
Event Grid and Service Bus
- Defender emits security events asynchronously
- Event Grid subscribes to Defender malware scanning events
- Event Grid delivers malware scan result events to an Azure Service Bus topic
- Fluxx uses an established Service Bus consumption pattern
- Application services do not consume Event Grid subscriptions directly
Event Grid Ownership Validation
- Event Grid ownership validation is enforced through Azure resource configuration
- No HTTP validation endpoint is required
- Authorization is established through Azure-managed identities and role assignments
- Event Grid is permitted to publish to the Service Bus topic
Scan Result Ingestion (File Intake)
Consumer Role
- File Intake is the sole consumer of malware scan result events
- File Intake subscribes to the Service Bus topic containing scan results
- File Intake is responsible for:
- Parsing Event Grid messages
- Correlating scan results to uploaded files
- Persisting scan results
- Triggering quarantine actions
Event Message Structure
Service Bus Message Body
- The message body contains the Event Grid event payload
- The payload is an array, including when a single event is emitted
File Intake processes only events of type: Microsoft.Security.MalwareScanningResultDetected
Correlation Strategy
Correlation ID
- The correlation ID is the blob URI
- The blob URI is stored in:
[fileIntake].[File].[InternalUrl] - Scan result events are correlated using this value
Scan Result Persistence Model
- Column: MalwareScanResult
- The column stores the scan result returned by Defender
- Possible values include:
- Malicious
- No Threat Found
- Error
- Not Scanned
If no scan result has been received, the column value is null
Processing Gate
- Downstream processing is allowed only when:
MalwareScanResultequalsNo Threat Found - Downstream processing is blocked when MalwareScanResult is:
- Malicious
- Error
- Not Scanned
- Null
Timing Model
- Malware scanning is asynchronous
- Scan completion commonly occurs within a few seconds
- No SLA exists for scan completion
- File Intake may wait briefly before responding to return a scan result when available
- Absence of a scan result is treated as pending