Entra sign-in and audit log review
Brief
A test against Entra ID leaves a sign-in for every token, an audit event for every consent and role change, and a Graph activity record for every directory read, but only where the client exports that log. The review pulls those records read-only before the licence's retention runs out and writes the defender's view: what was kept, what was never logged, and what alerted.
On this page
- Situation
- A finished test in an Entra ID tenant, our operator log with the UTC time, source address, test account and client app for each step, and a review identity with Reports Reader for the logs, read on the tenant's diagnostic settings, and Log Analytics Reader on the workspace the logs are exported to, if there is one. Every command reads logs or settings; nothing changes a diagnostic setting, a policy or a record, and only the tenant the scope letter names is reviewed. Run it within seven days of the test on a Free tenant and within 30 days on P1 or P2, or the copy Entra keeps is gone.
- Goal
- A defender's view section: each test step matched to the sign-in, audit or Graph activity record it produced, or to the retention or export gap that lost it.
- Outputs
- Representative examples on placeholder hosts, trimmed to the lines that matter. Not captured from a public fixture yet.
Check first
- Our operator log: UTC time, source address, test account, client app and call for each step.
- The licence: Entra ID Free keeps sign-in and audit logs seven days, P1 and P2 keep 30. Pull the logs before that runs out, whatever else is waiting.
- Whether the client exports the logs, to which workspace, storage account or SIEM, and which categories.
- The object ids of the test accounts and of the test application the client created, so every filter matches ours only.
- Who on the client side reads sign-in alerts, so the defender's view can say whether anyone acted, not only whether something fired.
Steps
Azure
Which licence and log export does the tenant have?
az rest --method get --url 'https://graph.microsoft.com/v1.0/subscribedSkus?$select=skuPartNumber,prepaidUnits' \
--query 'value[].[skuPartNumber,prepaidUnits.enabled]' -o tsv
az rest --method get \
--url 'https://management.azure.com/providers/microsoft.aadiam/diagnosticSettings?api-version=2017-04-01-preview' \
--query "value[].[name, join(',', properties.logs[?enabled].category)]" -o tsv
Expected output
SPE_E3 250
to-sentinel AuditLogs,SignInLogs,NonInteractiveUserSignInLogs,MicrosoftGraphActivityLogs # <- service principal sign-ins are not exported
Microsoft 365 E3 includes Entra ID P1, so Entra keeps 30 days of sign-ins and audit events. Graph activity logs exist only on P1 or P2 and only where they are exported: Entra keeps no copy, so a tenant without that category has no record of which directory objects anyone read. The export settings belong to the Entra resource provider, which is why the URL names no subscription.
Negative result. P1 or P2, with the audit log, every sign-in category and Graph activity logs exported.
Fix. Export the audit log, all sign-in categories and Graph activity logs to a workspace or storage account kept for the client's investigation window, commonly a year; without it, an intrusion found on day 31 has no sign-in history.
What did our sign-ins leave, interactive and not?
az monitor log-analytics query --workspace 0f1e2d3c-4b5a-4978-8a9b-0c1d2e3f4a5b --analytics-query "
union SigninLogs, AADNonInteractiveUserSignInLogs
| where TimeGenerated between (datetime(2026-10-27T13:00Z) .. datetime(2026-10-27T18:00Z))
| where UserPrincipalName == 'atarus-test1@corp.example.com'
| summarize Count = count() by Type, AppDisplayName, ResultType, ConditionalAccessStatus" \
--query '[].[Type,AppDisplayName,ResultType,ConditionalAccessStatus,Count]' -o tsv
Expected output
SigninLogs Microsoft Azure CLI 0 success 1
SigninLogs Microsoft Graph Command Line Tools 0 success 1
AADNonInteractiveUserSignInLogs Microsoft Azure CLI 0 success 38 # <- every token refresh during the enumeration
AADNonInteractiveUserSignInLogs Microsoft Graph Command Line Tools 0 success 12
Each tool's first token is an interactive sign-in and every refresh after it is a non-interactive one, which is where a long session lives. Graph PowerShell signs in as Microsoft Graph Command Line Tools. Without an export, Get-MgAuditLogSignIn reads the same records within retention; the v1.0 endpoint returns interactive sign-ins, and the beta signInEventTypes filter returns the rest.
Negative result. One interactive sign-in per tool per session, refreshes only from the apps in our log, all from our address, and the Conditional Access status the client expected.
Fix. Alert when an account signs in to Azure CLI or Graph PowerShell for the first time, and keep non-interactive sign-ins in the export.
What did the audit log record for consent and role activity?
Connect-MgGraph -Scopes 'AuditLog.Read.All','Directory.Read.All' -NoWelcome
Get-MgAuditLogDirectoryAudit -All -Filter ("activityDateTime ge 2026-10-27T13:00:00Z and " +
"initiatedBy/user/userPrincipalName eq 'atarus-test1@corp.example.com'") |
Select-Object ActivityDateTime, ActivityDisplayName, Category, Result
Expected output
ActivityDateTime ActivityDisplayName Category Result
---------------- ------------------- -------- ------
10/27/2026 3:41:07 PM Add member to role requested (PIM activation) RoleManagement success
10/27/2026 2:55:19 PM Consent to application ApplicationManagement success # <- the one consent the rules allowed
10/27/2026 2:55:19 PM Add delegated permission grant ApplicationManagement success
Directory reads are not audit events, so the whole enumeration leaves nothing here; only changes do. The consent to the client's test app writes Consent to application and Add delegated permission grant, the role activation the rules allowed writes its own event, and the consent's modified properties list the permissions granted, which the report quotes. With an export, the AuditLogs table in the workspace holds the same events past 30 days.
Negative result. Every event matches a change in our log, all by the test account, and none we did not make.
Fix. Alert on Consent to application by any user and on role activations outside a change window, and restrict user consent to verified publishers and low-risk permissions.
Did anything record the enumeration itself?
az monitor log-analytics query --workspace 0f1e2d3c-4b5a-4978-8a9b-0c1d2e3f4a5b --analytics-query "
MicrosoftGraphActivityLogs
| where TimeGenerated between (datetime(2026-10-27T13:00Z) .. datetime(2026-10-27T18:00Z))
| where UserId == '6c1a9e47-2b3d-4f58-9a0e-7d2c4b8f1e63'
| extend Resource = tostring(split(tostring(parse_url(RequestUri).Path), '/')[2])
| summarize Requests = count() by Resource, ResponseStatusCode
| order by Requests desc" \
--query '[].[Resource,ResponseStatusCode,Requests]' -o tsv
Expected output
users 200 412
groups 200 188
servicePrincipals 200 96
roleManagement 403 4 # <- refused reads of role assignments, the clearest sign of enumeration
This is the only log that shows which parts of the directory the test account read. It records the request, never the response body, and counts by resource are all the report needs. UserId is the test account's object id. Records usually arrive within 30 minutes and sometimes take up to two hours, so the query waits that long after the test.
Negative result. Request counts that match our log, from our address. An empty result with the category exported means the filter is wrong; with no export, the enumeration was never recorded, and that leads the defender's view.
Fix. Export Graph activity logs and alert on one user reading users, groups and service principals in bulk with refused role reads, a pattern ordinary users rarely produce.
The defender sees
Our review's own reads appear too: Azure CLI and Graph PowerShell sign-ins by the review identity, and our queries in the workspace's query audit where it is on. The report names them so nobody chases them.
Then the test itself, step by step:
| Our step | What Entra kept | What alerted |
|---|---|---|
| Sign-in as the test account with Azure CLI and Graph PowerShell | 2 interactive and 50 non-interactive sign-ins | Nothing |
| Directory enumeration | No audit events, by design; 700 Graph requests, kept only because the client exports them | Nothing |
| Consent to the client's test app | Consent to application and Add delegated permission grant | One SIEM alert, closed after our call |
| Eligible role activation | Add member to role requested (PIM activation) | The default PIM notification email |
The paragraph in the report says, in this order, what was kept, what was never logged and why, what alerted, and who acted, and gives retention as a date:
Defender's view. Entra ID kept every sign-in by the test account on 27 Oct 2026:
2 interactive and 50 non-interactive, all from 203.0.113.24, listed in appendix C.
The audit log kept the one consent and the one role activation we made. The 700
directory reads were recorded only because the tenant exports Graph activity logs,
and no rule reads them. The consent raised an alert, closed after we called; the
activation sent the default notification. The portal copy of these records expires
on 26 Nov 2026. Service principal sign-ins are not exported, so an attacker using
an app secret would leave no sign-in record after 30 days.
It describes our activity only and never claims the tenant is clean of anyone else's. Where nothing alerted, write that as its own finding with the identity finding write-up, beside the issue the test found.
Done when
Licence, retention and export are stated, every sign-in by the test accounts is counted as interactive or non-interactive with its Conditional Access status, every consent and role event is matched to our log, the enumeration's Graph requests are counted or marked as unlogged, and the defender's view paragraph is written.
Not covered
Reaching the account (see Entra ID enumeration from one user account), the Microsoft 365 unified audit log, Defender alerts, response to a real compromise, and AWS, which has its own page; the outputs shown are representative examples on a placeholder tenant, not captured runs.