Most cloud and SaaS audit events are now performed by service accounts, roles, apps and tokens, yet analysts often cannot tell from a log record whether a human or a machine acted, which credential was used, or who the machine was acting for. Each platform records non-human identities (NHIs) differently: a role session in AWS, a service principal or managed identity in Microsoft Entra, an impersonation chain in Google Cloud, a hashed token in GitHub. This guide maps the fields that identify the machine, the credential and the delegation chain on each platform, and shows how to correlate them into one view. It is for SOC analysts, detection engineers and NHI owners. Platforms are listed alphabetically; the order is not a ranking.
Key takeaways
- Read three things on every record. Which identity acted, which credential it presented, and whether it was acting on behalf of someone else. Every platform below exposes all three, in different fields.
- Delegation fields carry the real story. AWS
sessionContext.sessionIssuerandsourceIdentity, Google CloudserviceAccountDelegationInfoand EntraFederatedCredentialIdshow the identity behind the session. - Credential identifiers are the best pivot. Access key IDs, credential key IDs and thumbprints, service account key names and GitHub
hashed_tokenvalues let you find every action taken with one secret. - Machine sign-ins live in their own logs. Entra writes service principal and managed identity sign-ins to separate logs from user sign-ins, and Google Workspace records OAuth app activity in the token audit log.
- Normalise before you detect. Map each platform's fields to a common schema (actor, actor type, credential ID, delegated principal, source IP) so one rule covers every platform.
Why NHI log identification matters
Attackers who steal an API key or token act as that machine identity, and their activity blends with legitimate automation unless the analyst can see which credential was used and from where. ATT&CK describes the patterns: T1078.004 Cloud Accounts, T1550.001 Application Access Token and T1098.001 Additional Cloud Credentials. Each of these is detected by reading the identity fields correctly, not by the event name alone.
- Attribution: an action by a role or service account needs tracing back to the workload, pipeline or person that obtained the session.
- Scoping: when a secret leaks, the first question is "what did this credential do?", which needs a credential identifier in every record.
- Ownership: unowned identities show up as actors nobody recognises. Log identification feeds the inventory. See the NHI Discovery Across Cloud, SaaS, CI/CD and On-Premises Environments guide.
- Detection quality: baselines per identity only work if the identity field is stable. See the Service Account Behavioural Baselining Guide.
AWS
Every CloudTrail event carries a userIdentity element. Its type field takes values including Root, IAMUser, Role, FederatedUser, Directory, AWSAccount, AWSService, IdentityCenterUser, BuilderIdUser and Unknown; role sessions appear as AssumedRole in the documentation examples, and SAMLUser and WebIdentityUser mark calls to AssumeRoleWithSAML and AssumeRoleWithWebIdentity.
- Who acted:
arnandprincipalId. For a role session the ARN ends in the role session name, which pipelines and workloads often set to something meaningful. - Which credential:
accessKeyId, the key that signed the request (for temporary credentials, the temporary key ID).credentialIdis set when a bearer token, such as an IAM Identity Center access token, was used. - Delegation:
sessionContext.sessionIssuer(type, ARN, account and name of the role or user that issued the session),sessionContext.sourceIdentity(the original identity carried through role chaining),webIdFederationData.federatedProviderfor OIDC federation, andonBehalfOf, whosesubjectTypeisuserorworkload. - Service involvement:
invokedBynames the AWS service that made the call;inScopeOfshows the resource that credentials were issued to, withissuerTypesuch asAWS::Lambda::Function. - Workload hints:
sessionContext.ec2RoleDeliveryrecords1.0for IMDSv1 or2.0for IMDSv2, andattributes.mfaAuthenticatedshows whether MFA was used for the session.
Pivot on sessionIssuer.arn to see every session of a role, and on accessKeyId to scope a leaked key. See the AWS CloudTrail Guide and How to Investigate CloudTrail for a Compromised Access Key.
Azure
Microsoft Entra writes machine sign-ins to two logs separate from interactive user sign-ins: service principal sign-ins (apps authenticating with their own certificate or client secret, with no user involved) and managed identity sign-ins. Managed identity sign-ins appear only in the managed identity log. In Log Analytics they land in the AADServicePrincipalSignInLogs and AADManagedIdentitySignInLogs tables.
- Who acted:
ServicePrincipalId,ServicePrincipalNameandAppId; for managed identities,ManagedServiceIdentitygives detail of the identity used. - Which credential:
ServicePrincipalCredentialKeyIdandServicePrincipalCredentialThumbprintidentify the secret or certificate;ClientCredentialTypeshows the credential type. - Delegation and federation:
FederatedCredentialIdidentifies a workload identity federation credential, which links the sign-in to an external issuer such as a CI platform. - Target and context:
ResourceDisplayNameandResourceIdentityshow what the identity signed in to;IPAddress,ConditionalAccessStatus,ResultTypeandUniqueTokenIdentifiercomplete the picture.Locationis the region of the resource emitting the event; useLocationDetailsfor sign-in location.
In the Azure activity log, the Administrative category's caller is the email, UPN claim or SPN claim of whoever performed the operation, claims holds the JWT used against Resource Manager (including appid), and correlationId groups events that belong to one operation. Join activity log claims.appid to sign-in AppId to connect a resource change to the credential that authenticated it. See the Entra ID Sign-In and Audit Log Detection Guide and the Azure Managed Identities Security Guide.
Google Cloud
Cloud Audit Logs record identity in protoPayload.authenticationInfo.
- Who acted:
principalEmail(the user or service account email; populated asprincipalSubjectinstead for third-party callers) andprincipalSubject, which is set for both first-party and third-party identities. - Which credential:
serviceAccountKeyName, the full resource name of the service account key used to create or exchange the credentials. Its presence means a long-lived key was used rather than attached or impersonated credentials. - Delegation:
serviceAccountDelegationInfo, an ordered list of the real authorities that accessed resources through a service account, each with aprincipalSubjectand either afirstPartyPrincipalor athirdPartyPrincipal. Federated workload identities appear inprincipal://iam.googleapis.com/...form. - Applications:
oauthInfo.oauthClientIdnames the OAuth client acting on a user's behalf. - Context:
requestMetadata.callerIpandcallerSuppliedUserAgent.
Pivot on serviceAccountKeyName to scope a leaked key, and on the first entry of serviceAccountDelegationInfo to find who started an impersonation chain. The GCP Audit Log Principal Fields guide walks through chains step by step.
SaaS platforms
SaaS audit logs vary more than cloud logs, but the same three questions apply. Three common platforms, alphabetically:
GitHub
GitHub audit log events carry token data for personal access tokens, OAuth tokens, GitHub Apps (as an installation or on behalf of a user), deploy keys and SSH keys (the last two in public preview). hashed_token is the SHA-256 hash of the token used, programmatic_access_type the authentication type, and token_scopes the scopes where applicable. To scope a token, hash it (base64 output), then search hashed_token:"VALUE"; UI and REST searches do not return Git events, so export the audit log for those. The oauth_application, integration_installation and personal_access_token categories cover app and token lifecycle. See the GitHub Audit Log Detection Guide.
Google Workspace
The OAuth Token audit log (Reports API applicationName=token) records authorize, revoke and activity events. Each carries app_name, client_id and client_type; authorisations add scope, and activity events add api_name, method_name and num_response_bytes, which shows how much data an app pulled. Pivot on client_id across users to see an app's full reach. See the Google Workspace Audit Log Detection Guide.
Okta
The Okta System Log identifies the acting identity in the actor object (filter with actor.id), and transaction.detail.requestApiTokenId returns events made with a specific API token. transaction.id groups events from one operation, and authenticationContext.rootSessionId groups actions by an Okta system actor with the user sessions they belong to. See How to audit Okta API tokens and service apps.
Field reference by platform
| Platform | Identity field | Credential field | Delegation field | Grouping field |
|---|---|---|---|---|
| AWS CloudTrail | userIdentity.arn, type | accessKeyId, credentialId | sessionContext.sessionIssuer, sourceIdentity, onBehalfOf | sessionContext.attributes.creationDate with accessKeyId |
| Azure (Entra sign-ins, activity log) | ServicePrincipalId, AppId, activity caller | ServicePrincipalCredentialKeyId, ServicePrincipalCredentialThumbprint | FederatedCredentialId | UniqueTokenIdentifier, activity correlationId |
| Google Cloud Audit Logs | principalEmail, principalSubject | serviceAccountKeyName | serviceAccountDelegationInfo | oauthInfo.oauthClientId |
| GitHub audit log | actor | hashed_token, programmatic_access_type | GitHub App acting on behalf of a user (token type) | token_scopes |
| Google Workspace token audit | app_name, client_id | client_type, scope | User who authorised the app (event actor) | api_name, method_name |
| Okta System Log | actor.id | transaction.detail.requestApiTokenId | System actor linked by rootSessionId | transaction.id |
Correlation
Cross-platform investigations fail when the same machine identity has a different name in every log. Build a normalised view first, then detections on top.
| Common field | Purpose | Populate from |
|---|---|---|
| actor_id | Stable identifier of the acting identity | ARN, service principal object ID, service account email, GitHub actor, client ID, Okta actor ID |
| actor_type | Human, workload, app, token, platform service | CloudTrail type, sign-in log table name, principalSubject form, programmatic_access_type, client_type |
| credential_id | The specific secret, key, certificate or token | Access key ID, credential key ID or thumbprint, key name, hashed token, API token ID |
| delegated_from | Human or workload behind the session | sessionIssuer and sourceIdentity, federated credential, delegation chain, authorising user |
| owner | Accountable team | NHI inventory join on actor_id or credential_id |
- Collect the machine logs explicitly. Turn on Entra service principal and managed identity sign-in categories in diagnostic settings, Google Cloud Data Access logs where needed, GitHub audit log streaming and the Workspace token audit log. See the Cloud Logging and Audit Trail Guide.
- Map fields to the common schema in the SIEM parser, keeping the raw fields alongside.
- Join to the inventory on actor_id and credential_id so every event carries an owner. Unmatched identities are discovery findings.
- Pilot detections in alert-only mode for two weeks, tune against known automation, then promote. Roll back by returning a rule to alert-only.
- Write cross-platform rules: one credential_id used from two new networks, a federated identity minting long-lived keys (for example a new access key or service account key followed by use from an unknown IP), an app's
num_response_bytesor API call volume far above its baseline.
Decision guidance: a small organisation on one cloud and two SaaS platforms can start with saved searches per platform keyed on credential IDs. A large multi-cloud estate needs the normalised schema and an inventory join, because analysts cannot memorise six field models during an incident. See the Detection Engineering for Non-Human Identities Guide.
Measurement
- Attribution rate: percentage of machine-actor events that join to an inventoried, owned identity (target above 95 per cent).
- Credential coverage: percentage of events with a non-empty credential_id.
- Log category coverage: machine sign-in and token audit categories enabled per tenant, project and organisation (target 100 per cent).
- Time to scope a credential: minutes from a leaked secret report to a complete list of its actions.
- Unknown actor count: distinct machine actors seen in logs but absent from the inventory, trending down.
Framework mapping
| Framework | Reference | Relevance |
|---|---|---|
| NIST SP 800-53 Rev 5 | AU-3 Content of Audit Records; AU-6 Audit Record Review, Analysis, and Reporting | Records must identify the identity and credential; review across sources |
| NIST SP 800-53 Rev 5 | AC-2 Account Management; IA-9 Service Identification and Authentication | Service identities inventoried, owned and authenticated |
| NIST CSF 2.0 | DE.CM-03; DE.AE-03 | Monitoring technology usage; correlating across sources |
| MITRE ATT&CK v20 | T1078.004; T1550.001; T1098.001 | Cloud account use, token reuse and added credentials |
Common failure patterns
- Reading only the role ARN: every pipeline using one role looks identical; without
sourceIdentityor session names, attribution stops at the role. - Missing machine sign-in logs: collecting only interactive Entra sign-ins leaves every service principal and managed identity authentication invisible.
- Ignoring the delegation chain: attributing a Google Cloud action to the final service account rather than the first principal in
serviceAccountDelegationInfoblames the wrong owner. - Not keeping credential IDs: parsers that drop
accessKeyId, thumbprints orhashed_tokenmake leaked-secret scoping impossible. - Treating platform service actors as noise: blanket suppression of service-initiated events hides attacker activity carried out through a trusted integration.
Practitioner checklist
- Enable machine sign-in, token and data access audit categories on every cloud and SaaS tenant.
- Record actor, credential and delegation fields for each platform in a field map.
- Normalise to a common schema with actor_id, actor_type, credential_id and delegated_from.
- Join audit events to the NHI inventory and alert on unknown machine actors.
- Require meaningful role session names and set
sourceIdentitywhere pipelines assume roles. - Prepare saved searches that scope a credential by its identifier on each platform.
- Track attribution rate and time to scope a credential monthly.
Standards and references
- AWS: CloudTrail userIdentity element
- Microsoft Learn: Service principal sign-ins in Microsoft Entra ID
- Google Cloud: AuditLog and AuthenticationInfo reference
- GitHub Docs: Identifying audit log events performed by an access token
- Google Workspace: OAuth Token audit activity events
- Okta Developer: System Log query
- MITRE ATT&CK: T1550.001 Application Access Token
Related NHI Mgmt Group resources: Detection Engineering for Non-Human Identities Guide · GCP Audit Log Principal Fields · Bot Accounts vs Service Principals · NHI Dormancy Detection