How SharePoint Online Scans Uploaded Files for Viruses
Question details
Understand how SharePoint Online scans uploaded files for malware and whether its scanning service can scan files in Azure Storage.

- Product
- SharePoint Online and Azure Storage
- Device & OS
- not provided
- Scenario
- An administrator wants to protect files uploaded to SharePoint Online and files stored in Azure Storage.
- Observed behavior
- SharePoint Online scans uploaded files asynchronously. Azure Storage requires a separate supported malware-scanning solution.
Identify whether the files are stored in SharePoint Online or Azure Storage, since each service requires its own protection settings. To change SharePoint tenant settings, you need an account with the appropriate SharePoint administrator permissions.
Block downloads of infected SharePoint Online files
Use this setting to prevent users from downloading files that SharePoint Online has identified as infected.
SharePoint Online uses Microsoft 365 malware detection to scan uploaded files asynchronously. A detected file is flagged, but the scan does not necessarily finish at the moment of upload.
Install or open the SharePoint Online Management Shell on a supported computer.
Run Connect-SPOService -Url https://<tenant>-admin.sharepoint.com, replacing <tenant> with your tenant name, and sign in with an authorized administrator account.
Run Set-SPOTenant -DisallowInfectedFileDownload $true to prevent downloads of files detected as infected, including downloads through the antivirus warning.

Enable malware scanning for Azure Storage
Use a dedicated Azure Storage security service rather than the SharePoint Online scanning service.
Work with Office files in WPS Office
WPS Office is a free, lightweight alternative for working with documents, spreadsheets, and presentations in a familiar interface. Its Office-format support makes it easier to move existing files between applications. WPS Office does not replace SharePoint or Azure Storage malware scanning.

Frequently Asked Questions
Does SharePoint Online scan files immediately when they are uploaded?
SharePoint Online scans uploaded files asynchronously, so scanning may not be complete at the moment an upload finishes.
How do I prevent downloads of files detected as infected?
Connect to your tenant using Connect-SPOService in the SharePoint Online Management Shell, then run Set-SPOTenant -DisallowInfectedFileDownload $true.
Can I use SharePoint's virus-scanning service as an API for Azure Storage?
No. SharePoint Online's malware detection is not a general-purpose Azure Storage scanning API. Use Microsoft Defender for Storage or another supported security service instead.
Will enabling Defender for Storage automatically scan all existing files?
Do not assume it will. Check the current Defender for Storage documentation and settings for supported scanning options, including coverage for existing files.




