After understanding why attackers target cloud identities, let's dive into how we use their logs. This is where Microsoft Entra ID's logging capabilities become your most valuable tool.
Microsoft Entra ID generates detailed logs for every authentication attempt, configuration change, and administrative action within a tenant. These logs don't just tell you what happened, they tell you who did it, when, where from, and often why it succeeded or failed.
Entra ID Core Components
Before we explore the logs, let's understand the key components that generate them:
Users and Sign-ins (Authentication)
Every time a user attempts to authenticate to any service protected by Entra ID, a record is created. This includes successful logins, failed attempts, MFA challenges, and the context around each event (IP address, location, device, application, and others).
Roles and Access Decisions (Authorization)
After authentication, Entra ID determines what the user is allowed to do based on their assigned roles and permissions. Changes to these roles, group memberships, or permissions are all logged in audit events.
Security Features
Entra ID includes built-in security capabilities that generate their own logs:
- Multi-factor authentication (MFA): Logs show whether MFA was required, prompted, satisfied, or bypassed.
- Conditional Access policies: These policies enforce rules like "require MFA from untrusted locations." Logs show which policies were applied and their outcomes (allowed, blocked, MFA required).
- Identity Protection: Entra ID's native threat detection flags risky sign-ins (impossible travel, anonymous IP, password spray) and risky users. We won't dive deep into these in this room, but we will see how these logs can help us identify threats in the next room, Entra ID Monitoring.
Exploring Entra ID Logs
To explore the Entra ID logs and investigate the alert, we will use a Splunk instance. Start the lab by clicking the Start Lab Machine button below. You will then have access to the Splunk Web Interface.
To access Splunk, please wait for the VM to start and follow this link:
Please wait 4-5 minutes for the Splunk instance to launch. Use Splunk’s All Time range to search. The indexes where logs are stored for each practical exercise are present in each task.
Sign-in Logs
The alert you are tasked to investigate mentions multiple failed authentication attempts followed by a successful login. The Sign-in logs capture every authentication attempt made against a tenant. It will show you the brute force pattern and the moment the attacker succeeded!
In the Splunk instance, you can start hunting by filtering all the Sign-in (authentication) logs:
| List all Sign-in events |
index=scenario sourcetype="azure:aad:signin"
|
Entra ID was previously named Azure Active Directory (Azure AD). When you see "Azure Active Directory" or "Azure AD" in the logs or elsewhere, it is the same as Entra ID.
The structure of a Sign-in log has a couple of fields that may help you identify a suspicious authentication attempt:
{
"id": "014adaeb-c9db-4119-8a9b-a9f68dd4b700",
"createdDateTime": "2026-02-11T17:15:10Z",
"userDisplayName": "John Doe",
"userPrincipalName": "john.doe@contoso.onmicrosoft.com", // The user address
"userId": "a1b2c3d4-e5f6-7890-a1b2-c3d4e5f67890",
"appId": "4765445b-32c6-49b0-83e6-1d93765276ca",
"appDisplayName": "OfficeHome", // Which application the user logged in to. In this case, the main web portal (office.com)
"ipAddress": "203.0.113.45", // The IP address used by the user.
"clientAppUsed": "Browser",
"correlationId": "dc8fb3db-403c-43e4-b759-21aa137a143a",
"conditionalAccessStatus": "success",
"isInteractive": true,
[...]
"resourceDisplayName": "OfficeHome",
"resourceId": "4765445b-32c6-49b0-83e6-1d93765276ca",
"status": {
"errorCode": 0, // The result of the authentication. Code 0 means successful.
"failureReason": "Other.",
"additionalDetails": null
[...]
"location": { // Details about the location from the IP address used by the user.
"city": "New York",
"state": "New York",
"countryOrRegion": "US",
"geoCoordinates": {
"altitude": null,
"latitude": 40.7128,
"longitude": -74.0060
}
},
"appliedConditionalAccessPolicies": [ // Information about which access control policy was applied during the authentication process.
{
"id": "c63499f4-64b6-4943-bfc3-52fbb641ef10",
"displayName": "Require MFA",
"enforcedGrantControls": ["Block"],
"enforcedSessionControls": [],
"result": "notApplied"
}
]
}
With this context, you can use the errorCode to find failure attempts and other relevant data:
| List all failed Sign-ins |
index="scenario" sourcetype="azure:aad:signin" "status.errorCode"!=0
| stats count as event_count values(ipAddress) as ip_addresses
values(appDisplayName) as applications values(status.errorCode) as errorCodes by userPrincipalName
| sort - event_count
| table applications, userPrincipalName, ip_addresses, errorCodes, event_count
|
Error codes are a big ally when analyzing suspicious authentication alerts. They can help you to understand the stage of a credential attack the attacker is in. Below are common error codes:
50126: Invalid username or password
50053: Account locked due to too many failed attempts
50074: MFA required but not provided
50055: Password expired
If you want to verify what an error code means, Microsoft has a useful tool to help you research it.
In the same query results, you can see that all failed attempts are from the same source IP in the ipAddress field. This is relevant information for further investigation into what this IP address has done in the tenant.
Now, you can filter the successful logins from this source and validate which account was compromised and the applications the attacker accessed by changing the <ADD-IPHERE> placeholder to the IP address you want to investigate in the following query:
| List all successful Sign-ins from an IP address |
index=scenario sourcetype="azure:aad:signin" "status.errorCode"=0 ipAddress="<ADD-IP-HERE>"
| stats values(ipAddress) as ip_addresses values(appDisplayName) as applications by userPrincipalName
| table applications, userPrincipalName, ip_addresses
|
You should see the exact account that the attacker compromised!
Practice
For this task, you will answer a couple of questions regarding this suspicious authentication.
With the filter index=scenario sourcetype="azure:aad:signin", you will be able to see all Sign-in logs, but feel free to use any other queries you learned in this task.
Remember to search for All Time to find all log activity.