Copilot for Microsoft 365 Tech Accelerator
Feb 28 2024 07:00 AM - Feb 29 2024 10:30 AM (PST)
Microsoft Tech Community

Downloading mass of Unified Audit Logs (UAL) data

Copper Contributor



I work in data forensics. We often need to download months of UAL data from customers' Office 365 environment to analyze incidents. For example, I recently had to download 3 months of data, which summed up to 30 GB of data (CSV w/ embedded JSON). We do not want to filter on RecordType, UserIds, Operations, Workload, etc. We need everything.

We are currently downloading data, by slices of 15 minutes, using the Search-UnifiedAuditLog PowerShell command. If we use bigger intervals, we experience errors (e. g., missing/empty data, timeouts, crashes, etc). Even then, we still experience errors every now and then. Also, we can never be sure that our data is 100% complete.

All in all, it can take us up to 4 work days to be able to download a full set of 3 months / 30 GB of UAL data. That is the first step before we can start analyzing the data (e. g., importing the data to a database, adding indexes, augmenting the data with other sources of information, running queries, building new queries based on the specific incident, etc). The process is slow and painful. I have even started catching exceptions and sending them by SMS to my personal cell phone.

Would any of you know of a more suitable way of gathering heaps of UAL data? Note: not downloading a copy of the whole data (e. g., running queries manually through the Security & Compliance Center) is out of the question, partly for preservation / legal reasons.

Thanks! :)



5 Replies

Exchange Remote PowerShell is definitely not the best tool to work with such amounts of data. 

Take a look at the Management activity APIs instead:


@Vasil MichevThis will not work for us as it would require too much setup plus we cannot predict which of our customers have Active Directory LDAP, Azure Active Directory (AAD) or neither.

Vasil, the management activity API's are generally not suited to forensics because they are limited to retrieving data that's no more than 7 days old. Per the documentation linked above, the start time and end date query parameters must conform to the following:

"Both must be specified (or both omitted) and they must be no more than 24 hours apart, with the start time no more than 7 days in the past."
@scharest interested to know if you've made any progress or found any solutions to this issue. This is a constant thorn in the side of forensic investigators at my company as well.
We developed our own fetching script in PowerShell. We also compared it to different tools by comparing data and using statistics. So far, the best tool out there seems to be the Office 365 Extractor by PwC ( as it manages errors/timeouts/retries to some extent. So we mostly use that one, for UAL, and then we use our own tools for data processing and analysis. To fetch other types of data, we use our own PS scripts. Only UAL is a big problem: there is way too much throttling, random errors and/or unexplainable empty recordsets.