Azure Microsoft Graph Audit Logs integration via API

First of all, we log in to Azure with a user with administrator authorization.

Then we need to click on the Microsoft Entra ID tab and make App Registration from there.

I indicated where it is in the image.

You will only need to provide an application name related to the registration process.

After registering, you can see Client ID and Tenant ID information under overview. You need to save these. You will need them during the resource addition phase.

Then we need to click Certificates & secrets and create a Secret Value.

After clicking on the new client secret tab, let's write a name in the section on the right and specify the time you want it to be valid.

We need to make a note of the secret value we created. This information is visible once, you need to save it when you create it.

We need to enter the API Permission field, click Microsoft Graph and click Application Permission in the window that appears. Then just type audit in the search box, you can select everything under the auditlog tab in the field that appears.

You can open everything under the Audit tab that you want to get logs from this area.

The minimum permission the integration actually needs is AuditLog.Read.All (application permission). If you also plan to collect sign-in logs and you want to see which Conditional Access policy was evaluated, add Policy.Read.ConditionalAccess (or Policy.Read.All) as well. Without one of those policy permissions Microsoft Graph omits the applied Conditional Access policy list from the response, so the sign-in record still arrives but the policy name and the enforced control stay empty.

When finished, you need to click Grant admin consent and complete the authorization.

Then we can go to the source addition area and select API > Azure Microsoft Graph Audit and enter the information we have previously saved in this field and pull the logs to Logsign USO.

Then you need to enter the following fields on the source addition screen.

Screenshot 2025-01-02 at 9.45.51 AM.png

We have collected the information required to get audit logs while configuring, we can write this data in the fields above. Scope and Base URL information is given below. If this information is written incorrectly, audit logs will not be received.

Client Secret > Obtained during configuration.

Client ID > Obtained during configuration.

Tenant ID > Obtained during configuration.

Scope > https://graph.microsoft.com/.default

Base URL > https://graph.microsoft.com

Log Types > Optional. Leave it empty to collect directory audit logs only, or select the routes you want to collect. See the section below.

Log Start Date > How far back the first collection reaches. It can only be set while the source is being created. If it is left unset, the poller starts 12 hours back.

Then when you check connection, it should return success.

The connection check only requests an access token from Microsoft. It does not read the audit endpoints, so a missing permission or a missing license still returns success here and shows up later in the poller logs.

Log Types

The source can collect two Microsoft Graph routes. The Log Types field is a multiple selection and it is optional.

Selection Endpoint Requirements
Directory Audits (default) /v1.0/auditLogs/directoryAudits AuditLog.Read.All
Sign-ins /v1.0/auditLogs/signIns AuditLog.Read.All and a Microsoft Entra ID P1 or P2 license on the tenant

An empty selection means directory audits only, which is also what sources created before this field existed keep doing after an upgrade. Sign-in collection is opt-in: nothing changes on an existing source until you select Sign-ins and save it.

The two routes keep separate collection positions, so enabling sign-ins does not reset or interrupt the directory audit collection of the same source.

How the logs are collected

Each poll asks for one time window per selected route, at most 60 minutes wide, and follows the paging links until the window is finished (up to 50 pages, with a 2 second pause between pages). The request timeout is 180 seconds.

Microsoft Entra writes audit and sign-in records with a delay of a few minutes, so every window is re-read 30 minutes back and repeated records are removed by their record id. You should not see duplicates in Logsign because of this overlap.

Because of the 60 minute window and the 30 minute overlap, a source that is far behind moves forward around 30 minutes of log time per poll. Selecting a long Log Start Date value means the back-fill needs many poll cycles before the source reaches the current time.

Normalized fields

The fields below are filled for sign-in records. Directory audit records keep the same data under nested keys (for example initiatedBy_user_userPrincipalName), so for that route only the record id and the category are normalized and the rest stays under AzureGraphAudit.*.

Microsoft Graph field Logsign field
id Event.TrackID
createdDateTime Time.Generated
userPrincipalName Source.UserName
userDisplayName Source.DisplayName
userId Source.UserID
ipAddress Source.IP
appDisplayName Application.Name
resourceDisplayName Service.Name
deviceDetail.operatingSystem Source.OS
deviceDetail.deviceId Device.ID
status.errorCode Error.Code
status.failureReason Error.Message
riskLevelDuringSignIn Risk.Level
Conditional Access policy name Policy.Name
Conditional Access policy id Policy.ID
Conditional Access enforced control (for example Block or Mfa) Event.Action
Route name (SignIn or DirectoryAudit) Event.Category

A sign-in usually lists every Conditional Access policy of the tenant, including the ones that were not applied. Logsign keeps only the decisive ones: if a policy blocked the sign-in, that policy is written to Policy.Name, Policy.ID and Event.Action, otherwise the policies that were applied successfully are written. Policies with the result notApplied, notEnabled or report-only are dropped.

Fields that are not in the table above are still searchable under the raw AzureGraphAudit.* namespace, for example AzureGraphAudit.conditionalAccessStatus, AzureGraphAudit.caPolicyResult and AzureGraphAudit.location_city. Source country and city are filled from the GeoIP lookup of Source.IP.

Sign-in records are classified as Identity / User / Login when the status error code is 0, and as Identity / User / Deny for every other error code, including a Conditional Access block (error code 53003). Directory audit records keep the default Security / Alert / Info classification.

Troubleshooting

What you see Meaning and what to do
401 Unauthorized The cached token was rejected. Logsign drops it and retries once with a new token. If it keeps happening, check the Client ID, Client Secret, Tenant ID and Scope values, and whether the client secret has expired.
403 Forbidden The application is missing AuditLog.Read.All, admin consent was not granted, or, for the sign-ins route, the tenant has no Entra ID P1 or P2 license. The window is skipped and the position is not advanced, so nothing is lost once the permission is fixed.
429 Too Many Requests Microsoft throttles the identity reports at 5 requests per 10 seconds per tenant and returns no Retry-After header. The current window is dropped and retried in the next poll. If it repeats, check whether other Microsoft Graph sources in Logsign use the same app registration, because they share the same budget.
Sign-in records arrive but Policy.Name and Event.Action are empty The application has no Conditional Access read permission. Add Policy.Read.ConditionalAccess or Policy.Read.All and grant admin consent again.
"There are no new events." The window contained no record that was not sent before. This is normal on quiet tenants and during the overlap re-read.
Was this article helpful?
0 out of 0 found this helpful

Articles in this section

See more
Become a Certified Logsign User/Administrator
Sign-up for Logsign Academy and take the courses to learn about Logsign USO Platform in detail. Enjoy the courses, and get your badges and certificates. In these courses, you'll learn how to use Logsign in your work and add value to your career.
Visit Our Blog
Our Logsign USO Platform illustrate our expertise. So do the blog. Through our blog posts, deepen your knowledge on various SecOps topics or get updated about important news & modern approaches for cybersecurity. Get into the habit of reading valuable information provided by Logsign. Be a step ahead.