o365_persistent_login_activity_to_azure_ADPowerShell_app
Description
Continual logins to Azure AD PowerShell app are not a security best practice, if this is observed, additional investigation is needed
Query · yara_l
events:
$login.metadata.event_type = "USER_LOGIN"
$login.metadata.product_event_type = "UserLoggedIn"
$login.metadata.product_name = "Office 365"
$login.metadata.vendor_name = "Microsoft"
$login.target.resource.product_object_id = "1b730954-1685-4b74-9bfd-dac224a7b894"
$login.security_result.action = "ALLOW"
$login.target.user.userid = $userid
$login.metadata.event_timestamp.seconds = $time
match:
$userid over 24h
outcome:
$risk_score = 65
$event_count = count_distinct($login.metadata.id)
$entra_id_login_threshold = 2
$security_summary = array_distinct($login.security_result.summary)
$user_agent = array_distinct($login.network.http.user_agent)
$country_region_login_attempt = array_distinct($login.principal.ip_geo_artifact.location.country_or_region)
//added to populate alert graph with additional context
$principal_ip = array_distinct($login.principal.ip)
$target_user_userid = array_distinct($login.target.user.userid)
condition:
// Can set based on your own threshold
#time > 1