Detection rules › YARA-L
Entra ID Admin Login Activity to Uncommon MS Cloud Apps
Detects Azure AD admin login activity to apps other than a defined list of first party MS Cloud Apps. Note that Azure Active Directory PowerShell and custom Azure apps are not in this list by default
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Initial Access |
References
Telemetry coverage
Rule body
// Copyright 2025 Google LLC. Licensed under Apache-2.0.
rule entra_id_admin_login_activity_to_uncommon_mscloud_apps {
meta:
author = "Google Cloud Security"
description = "Detects Azure AD admin login activity to apps other than a defined list of first party MS Cloud Apps. Note that Azure Active Directory PowerShell and custom Azure apps are not in this list by default"
rule_id = "mr_59c94dc1-b7af-412c-aa2d-4b5834474f19"
rule_name = "Entra ID Admin Login Activity to Uncommon MS Cloud Apps"
assumption = "The lists first_party_ms_cloud_apps and entra_id_admin_watchlist are populated as needed"
tactic = "TA0001"
technique = "T1078.004"
reference = "https://learn.microsoft.com/en-us/troubleshoot/azure/active-directory/verify-first-party-apps-sign-in"
type = "alert"
platform = "azure"
data_source = "azure ad"
severity = "Medium"
priority = "Medium"
events:
$login.metadata.event_type = "USER_LOGIN"
$login.metadata.product_name = "Azure AD"
$login.metadata.vendor_name = "Microsoft"
$login.security_result.action = "ALLOW"
not $login.target.resource.attribute.labels["App Id"] in %first_party_ms_cloud_apps
//Use the list below to isolate activity to admins
//@domain.com is stripped off to reduce the values in the list to just the username of the email address
re.replace($login.target.user.userid, `@.*$`, "") in %entra_id_admin_watchlist
$login.target.user.userid = $userid
match:
$userid over 5m
outcome:
$risk_score = 65
$event_count = count_distinct($login.metadata.id)
$target_application = array_distinct($login.target.application)
$security_description = array_distinct($login.security_result.description)
$security_summary = array_distinct($login.security_result.summary)
$country_region_login_attempt = array_distinct(strings.concat($login.principal.location.city," ",$login.principal.location.state," ",$login.principal.location.country_or_region))
$user_agent = array_distinct($login.network.http.user_agent)
$principal_ip = array_distinct($login.principal.ip)
condition:
$login
}
YARA-L rule structure
Condition
Fires when at least one $login event in the 5m window.
Events
$login
security_result.action = "ALLOW"target.resource.attribute.labels["App Id"] in "%first_party_ms_cloud_apps"
Match and correlation
Outcome
Outcome variables add context to a detection. When the rule generates an alert, $risk_score is displayed with it.
| Field | Expression |
|---|---|
risk_score | 65 |
event_count | count_distinct($login.metadata.id) |
target_application | array_distinct($login.target.application) |
security_description | array_distinct($login.security_result.description) |
security_summary | array_distinct($login.security_result.summary) |
country_region_login_attempt | array_distinct(strings.concat($login.principal.location.city," ",$login.principal.location.state," ",$login.principal.location.country_or_region)) |
user_agent | array_distinct($login.network.http.user_agent) |
principal_ip | array_distinct($login.principal.ip) |