Entra ID Service Principal with Unusual Source ASN
editEntra ID Service Principal with Unusual Source ASN
editIdentifies Entra ID service principal sign-ins where the workload identity and source autonomous system number (ASN) together have not appeared in recent history. Attackers who obtain application secrets or tokens often authenticate from unfamiliar hosting providers, residential or VPN egress, or networks outside normal automation footprints, which can precede data access, lateral movement, or ransomware activity in the tenant. The detection emphasizes first-seen network context for non-interactive workload identities.
Rule type: new_terms
Rule indices:
- filebeat-*
- logs-azure.signinlogs-*
Severity: medium
Risk score: 47
Runs every: 1h
Searches indices from: now-65m (Date Math format, see also Additional look-back time)
Maximum alerts per execution: 100
References:
- https://learn.microsoft.com/en-us/entra/identity/monitoring-health/concept-sign-ins
- https://learn.microsoft.com/en-us/entra/identity/conditional-access/workload-identities
- https://www.microsoft.com/en-us/security/blog/2025/08/27/storm-0501s-evolving-techniques-lead-to-cloud-based-ransomware/
- https://www.wiz.io/blog/lateral-movement-risks-in-the-cloud-and-how-to-prevent-them-part-3-from-compromis
Tags:
- Domain: Cloud
- Domain: Identity
- Data Source: Azure
- Data Source: Microsoft Entra ID
- Data Source: Microsoft Entra ID Sign-In Logs
- Use Case: Identity and Access Audit
- Use Case: Threat Detection
- Tactic: Initial Access
- Resources: Investigation Guide
Version: 2
Rule authors:
- Elastic
Rule license: Elastic License v2
Investigation guide
editTriage and analysis
Investigating Entra ID Service Principal with Unusual Source ASN
This rule matches successful ServicePrincipalSignInLogs events where azure.signinlogs.properties.service_principal_id
and source.as.number together have not appeared in the rule history window. It is a first-seen network path signal for
the workload identity, not proof of compromise by itself.
Possible investigation steps
-
Confirm the event is ServicePrincipalSignInLogs with a successful outcome and review
azure.signinlogs.properties.status.error_codeon the source document if needed. -
Identify the application using
azure.signinlogs.properties.app_display_name,azure.signinlogs.properties.app_id, andazure.signinlogs.properties.service_principal_id. In Entra ID, review the enterprise application or app registration (first-party, partner, or internal automation). -
Review
source.ip,source.as.organization.name,source.as.number, andsource.geo.*against the owning team’s expected regions, cloud subscriptions, and CI/CD or automation footprint. -
Compare
@timestampto maintenance windows, releases, and planned infrastructure changes. -
Where possible, enrich
source.ipwith internal CMDB, cloud asset inventory, or threat intelligence (residential or low-reputation ASNs warrant more scrutiny than a known cloud provider already used by this app). -
In Entra sign-in logs, pivot on the same
service_principal_idorapp_idand review prior successful sign-ins for typical ASNs and egress patterns; a one-off path may be a new pipeline or stolen credentials used from a new host. - Review Entra audit logs for recent changes to this application: client secrets, certificates, federated credentials, owners, API permissions, or app role assignments, especially shortly before the alert.
-
Query Azure Activity, Microsoft Graph, or workload-specific logs after the sign-in time using
azure.signinlogs.properties.correlation_idorsession_idwhen present to see what resources the identity accessed (subscriptions, Key Vault, mail, privileged roles). -
Search for related alerts in the same time window involving the same
app_idorsource.ip(for example OAuth abuse, consent, Arc or Kubernetes access, or directory role changes). -
Note that the rule query excludes Microsoft-labeled
source.as.organization.namevalues; high-value investigations should also review raw sign-in data for suspicious activity that only appears under those labels.
False positive analysis
- New regions, subscriptions, GitHub Actions or Azure DevOps pools, DR exercises, or vendor migrations can produce a legitimate first-seen ASN for the service principal. Validate with the owner and document expected paths before excluding.
-
Amazon- and Google-labeled ASNs are in scope by design; adversaries may egress through AWS or GCP. Expect more noise from legitimate automation in those clouds and prefer allowlisting reviewed
app_idor automation accounts over disabling the rule. - GeoIP or ASN enrichment updates can occasionally produce a one-time new tuple; compare to historical events for the same IP if available.
Response and remediation
- If the path is unexpected and risky audit activity preceded the sign-in, treat as a potential credential incident: rotate application secrets and certificates, revoke sessions or tokens as applicable, and review Conditional Access and workload identity policies for the application.
- Review and reduce API permissions, OAuth scopes, and directory or subscription roles granted to the application; remove unused access.
- Document approved automation and network baselines so repeat first-seen ASN alerts can be triaged faster.
Rule query
editevent.dataset:azure.signinlogs
and azure.signinlogs.category:ServicePrincipalSignInLogs
and azure.signinlogs.properties.status.error_code:0
and azure.signinlogs.properties.service_principal_id:*
and source.as.number:*
and not source.as.organization.name:(*MICROSOFT* or *Microsoft*)
and not azure.signinlogs.properties.app_owner_tenant_id:(72f988bf-86f1-41af-91ab-2d7cd011db47 or f8cdef31-a31e-4b4a-93e4-5f571e91255a)
Framework: MITRE ATT&CKTM
-
Tactic:
- Name: Initial Access
- ID: TA0001
- Reference URL: https://attack.mitre.org/tactics/TA0001/
-
Technique:
- Name: Valid Accounts
- ID: T1078
- Reference URL: https://attack.mitre.org/techniques/T1078/
-
Sub-technique:
- Name: Cloud Accounts
- ID: T1078.004
- Reference URL: https://attack.mitre.org/techniques/T1078/004/
-
Tactic:
- Name: Defense Evasion
- ID: TA0005
- Reference URL: https://attack.mitre.org/tactics/TA0005/
-
Technique:
- Name: Valid Accounts
- ID: T1078
- Reference URL: https://attack.mitre.org/techniques/T1078/
-
Sub-technique:
- Name: Cloud Accounts
- ID: T1078.004
- Reference URL: https://attack.mitre.org/techniques/T1078/004/