entra_id_add_user_outside_pim
Description
Adding users to roles is expected but if it occurs outside of PIM, validation should occur
Query · yara_l
events:
$app.metadata.event_type = "USER_UNCATEGORIZED"
$app.metadata.product_name = "Azure AD Directory Audit"
$app.metadata.vendor_name = "Microsoft"
$app.security_result.action = "ALLOW"
$app.metadata.product_event_type = "Add member to role outside of PIM (permanent)" //triggered via PS API call
//Can add watchlist of specific roles by name using the following commented out line
//$app.target.resource.name in %entra_id_watchlist_roles
//Can add watchlist of specific roles by guid using the following commented out line
//$app.target.resource.attribute.labels["TemplateId"] in %entra_id_watchlist_roles_guid
$app.principal.user.userid = $user
match:
$user over 5m
outcome:
$risk_score = 65
$event_count = count_distinct($app.metadata.id)
$assigned_role = array_distinct($app.target.resource.name)
$assigned_role_guid = array_distinct($app.target.resource.attribute.labels["TemplateId"])
$network_session = array_distinct($app.network.session_id)
$userid_making_modification = array_distinct($app.principal.user.userid)
$principal_user_email_addresses = array_distinct($app.principal.user.email_addresses)
$modified_userid = array_distinct($app.target.user.email_addresses)
condition:
$app