Search-UnifiedAuditLog is scheduled to retire on October 15, 2027. What needs to change in scripts that use it, and is there still a practical way to run quick audit searches from PowerShell?
How much work is moving Search-UnifiedAuditLog scripts to Graph?
Answers
Plan for a rewrite rather than a cmdlet swap. AuditLogQuery is asynchronous: submit the query, poll its status until it succeeds, then retrieve the records with pagination. Scripts that expect results from one call will need a different flow.
Build in handling for queries that fail or take longer than expected, and test the paging logic against searches with plenty of results. You can still use PowerShell to call Graph, but the interaction won't look the same.
Reply to this answer
Sort out permissions early. An app registration using the API needs AuditLogsQuery.Read.All, so check the consent process with whoever manages security approvals before you get too far into testing. A working script is no use if it can't be authorized to run.
Reply to this answer
While you're testing, check how far back the audit data actually goes. Moving to Graph doesn't restore events that have already aged out or change the retention available under your licensing. A request for 180 days of history may only return 90 if that's all the tenant retains.
Reply to this answer
The capability to search audit logs isn't what's being retired here, just the old cmdlet. Graph provides a replacement, though it's fair to be annoyed that existing scripts need changes instead of getting a compatible backend update.
Reply to this answer
Add your answer
Answers are reviewed before publication.
_r6~obrik.91:
That polling step matters for quick checks too. A PowerShell wrapper could hide some of the steps, but it won't necessarily make the query finish immediately.