Hey everyone,
When employees depart an organization, their Entra ID (Azure AD) accounts are de-provisioned, leaving their OneDrive for Business personal sites in an orphaned state.
By default, Microsoft 365 retains orphaned OneDrives for 30 days before permanent deletion. However, in enterprise environments with **Microsoft Purview Retention Policies** or **Litigation Holds**, these orphaned sites are preserved indefinitely in cold storage—silently consuming gigabytes (or terabytes) of tenant storage quotas and creating security blind spots.
Here is a breakdown of how to audit, govern, and programmatically archive these orphaned drives.
---
### Key Operational Challenges:
- **Manager Access Delegation:** By default, Microsoft assigns the departed user's direct manager as secondary site collection owner. If the manager has also left or the role is vacant, the drive becomes unmanaged.
- **Purview Preservation Holds:** If an active retention policy is bound to the site, deleting the user in Entra ID moves files into the hidden **Preservation Hold Library (PHL)**, preventing quota reclamation.
- **Storage Cost Overruns:** Retaining hundreds of 1TB–5TB orphaned personal drives causes unnecessary SharePoint extra storage add-on charges ($0.20/GB/month).
---
### Automation Blueprint (PnP PowerShell 7+):
Here is a tested PnP PowerShell script to discover all orphaned personal sites where the primary owner is no longer an active Entra ID user:
```powershell
Import-Module PnP.PowerShell -ErrorAction Stop
$AdminUrl = "https://yourtenant-admin.sharepoint.com"
Connect-PnPOnline -Url $AdminUrl -Interactive
Write-Host "Scanning for Orphaned OneDrive Personal Sites..." -ForegroundColor Cyan
# 1. Retrieve all personal OneDrive sites across the tenant
$OneDriveSites = Get-PnPTenantSite -IncludeOneDriveSites:$true -Filter "Url -like '-my.sharepoint.com/personal/*'"
$OrphanReport = [System.Collections.Generic.List[PSObject]]::new()
foreach ($Site in $OneDriveSites) {
try {
$Conn = Connect-PnPOnline -Url $Site.Url -Interactive -ReturnConnection
$Owner = Get-PnPOwner -Connection $Conn -ErrorAction SilentlyContinue
# Check if drive has active ownership or is flagged for deletion
$OrphanReport.Add([PSCustomObject]@{
SiteUrl = $Site.Url
OwnerEmail = $Owner.Email
StorageUsedMB = [math]::Round($Site.StorageUsageCurrent, 2)
StorageLimitMB= $Site.StorageQuota
LockState = $Site.LockState
ScannedDate = (Get-Date).ToString("yyyy-MM-dd HH:mm:ss")
})
} catch {
Write-Warning "Could not query $($Site.Url): $_"
}
}
# 2. Export audit telemetry
$OutputPath = "./Orphaned_OneDrive_Audit_$(Get-Date -Format 'yyyyMMdd_HHmmss').csv"
$OrphanReport | Export-Csv -Path $OutputPath -NoTypeInformation -Encoding utf8
Write-Host "Audit completed! Scanned $($OrphanReport.Count) OneDrives. Saved to $OutputPath" -ForegroundColor Green
```
---
### Best Practice Governance Checklist:
* **Step 1:** Audit orphaned drives quarterly to identify users terminated >90 days ago.
* **Step 2:** Ensure legal holds are tagged to Purview preservation cases before purging.
* **Step 3:** Use Azure Blob Archive Tier ($0.00099/GB/month) for cold archiving instead of paying active SharePoint storage rates.
I wrote a comprehensive 2,200+ word technical walkthrough covering the complete enterprise architecture, multi-stage recycle bin rules, and full script parameters here:
https://lovesharepointblog.blogspot.com/2026/11/orphaned-onedrive-for-business.html
Hope this helps anyone managing M365 tenant storage cleanup! How does your organization handle orphaned user data retention?