- Zero-Spoof Baseline: Every custom M365 domain must publish a clean SPF record (<10 DNS lookups), enable 2048-bit DKIM signing in Exchange Online, and progress DMARC from
p=none→p=quarantine→p=reject. - Forwarding & Transport Hardening: Configure Trusted ARC Sealers (
Set-ArcConfig) for third-party gateways and enable Inbound SMTP DANE + DNSSEC to defeat downgrade/MITM attacks. - Defender Preset Policies: Replace ad-hoc anti-phishing rules with Microsoft's Standard / Strict Preset Security Policies + Safe Links + Safe Attachments + Zero-Hour Auto Purge (ZAP).
In Chapter 5, we mastered Exchange Online connectors, transport rules, and Get-MessageTraceV2. In Chapter 6, we lock down the #1 enterprise attack vector—email—by layering cryptographic authentication (SPF, DKIM, DMARC, ARC, DANE) with Microsoft Defender for Office 365.
1. The 5-Layer Email Authentication & Protection Stack
2. Auditing SPF, DKIM & DMARC Across Every Accepted Domain
Don't check domains one by one in DNS tools. Run a single PowerShell audit across every accepted domain in your tenant (see our full SPF/DKIM/DMARC All-Domains PowerShell Audit):
Connect-ExchangeOnline -ShowBanner:$false
$domains = Get-AcceptedDomain | Where-Object { $_.DomainName -notlike '*.onmicrosoft.com' }
$report = foreach ($d in $domains) {
$name = $d.DomainName
$dkim = Get-DkimSigningConfig -Identity $name -ErrorAction SilentlyContinue
$spf = (Resolve-DnsName -Name $name -Type TXT -ErrorAction SilentlyContinue).Strings | Where-Object { $_ -like 'v=spf1*' } | Select-Object -First 1
$dmarc = (Resolve-DnsName -Name "_dmarc.$name" -Type TXT -ErrorAction SilentlyContinue).Strings | Where-Object { $_ -like 'v=DMARC1*' } | Select-Object -First 1
[PSCustomObject]@{
Domain = $name
SPF = if ($spf) { $spf } else { "MISSING" }
DKIMEnabled = if ($dkim) { $dkim.Enabled } else { $false }
DKIMKeySize = if ($dkim) { $dkim.Selector1KeySize } else { "N/A" }
DMARC = if ($dmarc) { $dmarc } else { "MISSING" }
}
}
$report | Format-Table -AutoSize
3. Enabling 2048-Bit DKIM, Trusted ARC Sealers & Inbound DANE
# 1. Enable 2048-bit DKIM signing on a custom domain (after publishing selector1 & selector2 CNAMEs)
New-DkimSigningConfig -DomainName "lab365.in" -KeySize 2048 -Enabled $true
# 2. Configure Trusted ARC Sealers if mail flows through an external gateway/forwarder
Set-ArcConfig -Identity Default -ArcTrustedSealers "gateway.partner.com"
# 3. Enable Inbound SMTP DANE with DNSSEC on Exchange Online
Enable-DnssecForVerifiedDomain -DomainName "lab365.in"
Enable-SmtpDaneInbound -DomainName "lab365.in"
For full step-by-step DNS cutover details, see our companion runbooks on Configuring Trusted ARC Sealers (Set-ArcConfig) and Enabling Inbound SMTP DANE + DNSSEC in Exchange Online.
4. Auditing Microsoft Defender for Office 365 Protection Posture
Verify that Zero-Hour Auto Purge (ZAP), Anti-Phishing Impersonation Protection, and Safe Links / Safe Attachments are active:
# Verify Anti-Phish policies & Mailbox Intelligence
Get-AntiPhishPolicy |
Select-Object Name, Enabled, EnableMailboxIntelligence, EnableMailboxIntelligenceProtection, EnableSpoofIntelligence, PhishThresholdLevel |
Format-Table -AutoSize
# Verify Preset Security Policy rules (Standard & Strict)
Get-EOPProtectionPolicyRule | Select-Object Name, State, Priority, SentToMemberOf | Format-Table -AutoSize
Get-ATPProtectionPolicyRule | Select-Object Name, State, Priority, SentToMemberOf | Format-Table -AutoSize
Chapter 6 Verification Checklist
- [ ] Every custom domain has SPF (
~allor-all, under 10 DNS lookups), 2048-bit DKIM enabled, and DMARC atp=quarantineorp=reject. - [ ] Parked/non-sending domains publish
v=spf1 -allandv=DMARC1; p=reject;. - [ ] Standard Preset Security Policy covers all users, and Strict Preset Security Policy protects executives and IT admins.
- [ ] Inbound SMTP DANE + DNSSEC is enabled on primary receiving domains.
💬 Reader Comments & Feedback
Did this runbook help, or did Microsoft change a cmdlet or UI menu? Share your feedback below.
Leave a Comment or Report an Update