Before you run
Data & scope
- Required tables
- Time window
- 7 days
- Microsoft Entra ID connector with AADServicePrincipalSignInLogs collected for seven days.
- Microsoft Entra ID P1 or P2 for ingestion and access to correlate application credential metadata.
Documentation review by Codex (AI). No live-tenant execution or detection-performance claim. Validate schema, data coverage and expected results in your workspace.
// Hunting starter. Documentation checked 2026-11-13; not tenant-tested.
AADServicePrincipalSignInLogs
| where TimeGenerated >= ago(7d) and TimeGenerated <= now()
| where ResultType =~ "Success" or tolong(ResultType) == 0
| extend CredentialType = iff(isempty(ClientCredentialType), "Not reported", ClientCredentialType),
CredentialKeyId = ServicePrincipalCredentialKeyId,
FederationId = FederatedCredentialId
| summarize SignInRows = count(), FirstSeen = min(TimeGenerated),
LastSeen = max(TimeGenerated), SourceIPs = make_set(IPAddress, 10),
Resources = make_set(ResourceIdentity, 10),
Thumbprints = make_set(ServicePrincipalCredentialThumbprint, 5)
by AADTenantId, ServicePrincipalId, ServicePrincipalName, AppId,
CredentialType, CredentialKeyId, FederationId
| extend IdentifierCoverage = case(
isnotempty(FederationId), "Federated credential ID recorded",
isnotempty(CredentialKeyId), "Credential key ID recorded",
"No credential identifier recorded")
| order by ServicePrincipalName asc, LastSeen desc
| take 200
Read-only query. Run in your own authorized workspace after checking prerequisites.
This inventory shows the credential metadata present in successful application sign-ins. It helps an owner check which credential paths are actually observed during rotation or migration to workload federation. It deliberately reports identifiers and types, never secret values or bearer tokens.
Separate observed use from configured inventory
ClientCredentialType describes the reported authentication mechanism. ServicePrincipalCredentialKeyId and FederatedCredentialId identify different credential contexts, and the query retains both rather than collapsing them into a guessed common key. A recorded thumbprint is a bounded sample for correlation, not sensitive credential material itself. See the current table contract.
No credential identifier recorded means the available row lacks both selected IDs. It does not mean that the request was anonymous, used a shared secret, or bypassed authentication. Likewise, a credential configured in the directory but unused during the week will not appear. This query cannot replace a directory credential inventory or a permission review.
The first and last timestamps describe observations inside seven days. They are not credential creation, expiry or revocation times. Do not infer a certificate lifetime or federation trust condition from the sign-in group.
Use the inventory during a controlled change
Resolve each principal and compare the observed identifiers with the approved credential rotation record. Confirm whether both old and new credentials were expected during an overlap period. If the old identifier still appears after its intended retirement, inspect the application deployment and original events before concluding that revocation failed.
For federation, review the configured issuer, subject and audience separately. A federation ID records an authentication context; it does not demonstrate that its trust is narrowly scoped. For certificates and secrets, review access to the runtime and credential management process independently.
Validate the evidence
Test a known certificate-based sign-in, a known federated event and a record with missing identifier fields. Confirm that the label reflects only the fields actually present. Cross-check current directory metadata using object IDs rather than application names.
This documentation-checked hunt has not been executed in a tenant. It omits managed identity and delegated user tables by design. The display cap can hide additional groups, so narrow to a specific principal for a complete rotation review. Microsoft’s application security operations guidance provides related monitoring considerations; runtime authorization and downstream actions still need their own evidence.
Verify the source
Microsoft references
Measure normal activity, validate known test cases, account for ingestion delays, choose a threshold and entity mapping, and assign an owner. Results require investigation.
Follow the detection learning path →