Defedner for Microsoft 365, Identity (Entra) & Endpoint Audit Scripts
Two PowerShell scripts that take a snapshot of how your tenant is configured and hand you a tidy CSV and a color-coded HTML report. It read — it never change a single setting, so you can run them on a Friday afternoon without holding your breath.
Think of them as a flashlight, not a wrench. They show you what's there; you decide what to fix.
| Script | What it looks at |
|---|---|
| M365SecurityAudit.ps1 | Defender for Office 365 (email/collaboration policies) + Entra identity (Security Defaults, Conditional Access, authorization policy) |
| DefenderEndpointAudit.ps1 | Defender for Endpoint (device fleet posture + ASR rules) |
They're deliberately kept separate because they talk to different services and need different permissions. Run one, run the other, or run both — they don't depend on each other.
Before you start
You'll need PowerShell 5.1 or (better) PowerShell 7, and depending on which script you're running, a couple of modules.
For the M365 script:
Install-Module ExchangeOnlineManagement -Scope CurrentUser
Install-Module Microsoft.Graph -Scope CurrentUser
The Endpoint script doesn't need extra modules for its main (tenant) mode — it talks to the Defender API directly over HTTPS. Its optional local ASR check uses Get-MpPreference, which already ships with Windows.
Download
M365SecurityAudit.ps1
DefenderEndpointAudit.ps1