How to Back Up Entra ID Users Before a Bulk PowerShell Change
A pre-change export gives you something concrete to compare against when a bulk update does not go as planned.
The problem administrators face
Bulk user updates in Entra ID are routine: normalising department values, populating extension attributes, fixing usageLocation before licence assignment, or aligning jobTitle with an HR feed. PowerShell makes it easy to touch thousands of accounts in minutes. What is harder is recovering when the script targets the wrong filter, maps columns incorrectly, or clears fields you did not intend to change.
Without a backup taken immediately before the change, you are relying on memory, partial audit data, or an older export that may not reflect production.
What Microsoft provides natively
Microsoft offers several read paths, none of which are framed as a pre-change backup workflow:
- Entra admin centre — limited user export (useful, but not every attribute you might need for recovery).
- Microsoft Graph —
GET /userswith$selectto limit properties; supports pagination for large tenants. - Microsoft Graph PowerShell —
Get-MgUserwith-Propertyor-Allfor directory reads.
Entra does not schedule or version these exports for you, and there is no built-in “restore user attributes from backup” action tied to a snapshot you took yourself.
The gap and operational risk
Point-in-time CSV or JSON files are only as good as the attributes you included and the moment you captured them. Teams often export a minimal column set for reporting, then later discover they need extension attributes, assignment metadata, or manager references that were never in the file.
Exports stored on a shared drive also drift from production quickly. A backup from last month is a poor rollback reference for a change you run today. The operational risk is discovering — after the script completes — that your safety net has holes.
A practical manual approach
Treat every bulk change as a small release with a documented pre-flight export:
- Define the attributes your script will write and the attributes you would need to restore if it fails.
- Export those properties for the same scope the script will touch (OU filter, attribute filter, or explicit ID list).
- Name the file with date, time, and change ticket; store it where the on-call engineer can find it.
- Run
-WhatIfor a pilot batch; compare counts and sample rows against the export. - Execute the production run; keep the export until the change is validated and the ticket is closed.
Example export pattern:
$props = @('id','userPrincipalName','displayName','department','jobTitle','officeLocation')
$users = Get-MgUser -Filter "startswith(department,'Sales')" -Property $props -All
$users | Select-Object $props | Export-Csv ".\backup-sales-dept-$(Get-Date -Format yyyyMMdd-HHmm).csv" -NoTypeInformation
If you must recover, join audit log results to your CSV on id or userPrincipalName, then issue corrective Update-MgUser calls. Document every manual fix — you are now the restore engine.
Where attribute-level backup helps
EntraExportRestore formalises the same habit: configurable attribute selection via a catalog, identified snapshots in a local database, and optional scheduled exports before recurring automation. Restore operations show a preview of current versus captured values so you can recover selectively instead of re-importing an entire CSV blindly.
It does not replace change control or testing; it gives you a repeatable snapshot step when manual exports become too tedious to run before every script.
Next steps
Review the pre-change checklist for Entra ID administrators, the EntraExportRestore overview, or the Microsoft Marketplace listing.