Home > Blog > Microsoft 365 Administrator > M365 Security Auditing and Reporting with PowerShell

M365 Security Auditing and Reporting with PowerShell

Study Guide Cert Sensei Team 2026-09-02 9 min read

Security auditing in M365 relies on the Unified Audit Log, which can be queried effectively using the Search-UnifiedAuditLog PowerShell cmdlet to investigate suspicious activities. Preparing for security incident scenarios on the MS-102 exam is highly effective when leveraging practice environments and tools like Cert Sensei.

#Security #Auditing #PowerShell #MS-102 #Microsoft 365

The Unified Audit Log

The Unified Audit Log (UAL) is the central repository for user and administrator activities across M365 workloads.

Ensuring auditing is enabled is the crucial first step for any security baseline.

Using Search-UnifiedAuditLog

The `Search-UnifiedAuditLog` cmdlet is the primary tool for extracting security events programmatically.

Admins can filter by date, specific user, or record type to track down unauthorized file access or login failures.

Exporting Reports for Analysis

Audit data is vast and often needs to be parsed in external tools like Excel or a SIEM system.

PowerShell seamlessly pipes audit results to CSV files, making data manipulation and long-term retention simple.

Automating Security Alerts

Beyond manual searches, admins can script scheduled tasks to monitor for specific high-risk actions.

These scripts can trigger email alerts if actions like mass file deletions or external forwarding rules are detected.

❓ Frequently Asked Questions

What is the central repository for auditing M365 activities?

The Unified Audit Log (UAL) serves as the central repository for user and administrator activities.


Which cmdlet is used to extract security events programmatically?

The Search-UnifiedAuditLog cmdlet is used to extract and filter security events.


How can admins use audit data for long-term retention?

Admins can use PowerShell to pipe audit results to CSV files or integrate them with a SIEM system.

More from Microsoft 365 Administrator

🧠

Test Your Knowledge

Ready to practice 365 Administrator? Put what you've learned to the test.

Try 10 Free Questions

⭐ 1,000 expert-curated questions available with Premium

Upgrade Premium
📖 Browse the Glossary

Join thousands of certification students

Sign Up Free