entra_id_login_activity_to_uncommon_mscloud_apps
Description
This rule detects Azure AD 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
Query · yara_l
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
// Below is to filter ADFS Sync Account that runs every 30 minutes between AD and Azure; can use userid or email address
//$login.target.user.userid = "insert your userid here"
$login.target.user.user_display_name != "On-Premises Directory Synchronization Service Account"
$login.target.user.userid = $userid
match:
$userid over 5m
outcome:
$risk_score = 35
$event_count = count_distinct($login.metadata.id)
$target_application = array_distinct($login.target.application)
$traget_application_guid = array_distinct($login.target.resource.attribute.labels["App Id"])
$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))
//Used for match condition, don't need as outcome variable as well
//$target_user_userid = array_distinct($login.target.user.userid)
condition:
$login