Forum Discussion

TonyRedmond's avatar
Dec 02, 2026

Use JSON Batching with PowerShell to Fetch Entra ID Audit Sign-In Logs

Microsoft 365 tenants generate an awful lot of Entra audit sign-in logs. Fetching all that data can take a long time. Even if you need to write more code, JSON batching is a fast and efficient way to fetch large quantities of Entra audit sign-in logs by dividing up retrieval across multiple requests and combing the output into one set. Everything works nicely and we have an example PowerShell script to show how, and a warning about attacks against user accounts revealed by the data.

https://office365itpros.com/2026/12/02/json-batching-audit-sign-in-logs/

1 Reply

  • The article explains how to use Microsoft Graph JSON batching with PowerShell to retrieve large volumes of Microsoft Entra ID audit sign-in logs faster.

     

    Key points:

     

    - Divide log retrieval into smaller time-based requests.

    - Process up to 20 requests per JSON batch.

    - Retrieve up to 1,000 records per request.

    - Handle pagination, throttling (HTTP 429), and retries.

    - Combine and export results into CSV or Excel.

    - Use `AuditLog.Read.All` permission.

     

    Security warning: Reviewing sign-in logs can reveal suspicious login attempts and attackers targeting tenant accounts.

     

    The PowerShell example is available in the [Microsoft 365 for IT Pros GitHub repository : https://github.com/Office365ITPros

     

    Source: Original article : https://office365itpros.com/2026/12/02/json-batching-audit-sign-in-logs/