Unable to obtain B2C audit logs via MS Graph

Allen Yang 21 Reputation points
2025-05-07T04:04:56.92+00:00

Hi team,

I am using MS Graph API to get the audit log of Azure B2C. The results are normal for the first time, but if I continue to use nextLink to get the rest of the result, there is a chance that an unknown error will be returned.

User's image

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
24,659 questions
0 comments No comments
{count} votes

Accepted answer
  1. Vigneshwar Duvva 875 Reputation points Microsoft External Staff Moderator
    2025-05-07T14:09:10.76+00:00

    Hello @Allen Yang

    When using the Microsoft Graph API to retrieve audit logs for Azure B2C, it's common to paginate through results using @odata.nextLink. If you're encountering intermittent errors when following the nextLink

    Ensure the nextLink URL is used exactly as provided—do not decode or modify it.

    To achieve this, you need to:

    Select the beta endpoint

    Add $count=true in the QueryString

    Add ConsistencyLevel = eventual to the Request headers

    https://graph.microsoft.com/v1.0/auditLogs/directoryAudits?$filter=loggedByService eq 'B2C' and activityDateTime gt 2019-09-10T02:28:17Z&$count=true

    User's image

    Reference : https://devblogs.microsoft.com/microsoft365dev/build-advanced-queries-with-count-filter-search-and-orderby/
    Hope this helps. Do let us know if you have any further queries.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.