The following privileges/roles are required in the Entra ID tenant and Exchange Online instance:

  • Entra ID tenant: Global Reader role.

  • Exchange Online environment: View-Only Audit Logs role. This role is granted by default to the Compliance Management and Organization Management role groups (to which members can be assigned). Members can be assigned to the aforementioned groups through the Exchange administration portal.

    If the required rights are not correctly granted to the user conducting the log collection, the following error will arise:

    Search-UnifiedAuditLog : The term 'Search-UnifiedAuditLog' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    
  • Azure subscription (for retrieving Azure Activity logs for the given subscription): Log Analytics Reader role.

  • Azure DevOps organization (for retrieving Azure DevOps Activity logs for the given Azure DevOps organization): Auditing\View audit log permission.

Note that accessing Entra ID logs through the MS Graph API requires at least one user with a Microsoft Entra ID P1 or Microsoft Entra ID P2 license (formerly Azure AD Premium P1 / P2). These licenses can be included in other license plans, such as Microsoft 365 E3/E5/F3. The user to which the license is assigned does not matter.



View on GitHub