Detection rules › Kusto

Power Automate - Departing employee flow activity

Status
available
Severity
high
Time window
7d
Group by
ActorName, UserPrincipalName
Source
github.com/Azure/Azure-Sentinel

Identifies instances where an employee who has been notified or is already terminated, on the TerminatedEmployees watchlist, creates or modifies a Power Automate flow.

MITRE ATT&CK coverage

Rule body kusto

id: b1e11b8c-545a-4dea-a912-0008e160d183
kind: Scheduled
name: Power Automate - Departing employee flow activity
description: Identifies instances where an employee who has been notified or is already
  terminated, on the TerminatedEmployees watchlist, creates or modifies a Power Automate
  flow.
severity: High
status: Available
requiredDataConnectors:
  - connectorId: PowerAutomate
    dataTypes:
      - PowerAutomateActivity
queryFrequency: 1h
queryPeriod: 7d
triggerOperator: gt
triggerThreshold: 0
tactics:
  - Exfiltration
  - Impact
relevantTechniques:
  - T1567
  - T1485
  - T1491
  - T0813
  - T0879
  - T0826
query: |
  let query_frequency = 1h;
  PowerAutomateActivity
  | where TimeGenerated >= ago(query_frequency)
  | where EventOriginalType in ("CreateFlow", "EditFlow")
  | join kind=inner (MSBizAppsTerminatedEmployees()) on $left.ActorName == $right.UserPrincipalName
  | extend path = parse_url(FlowDetailsUrl).Path
  | extend EnvironmentId = tostring(split(path, "/")[2])
  | extend FlowId = tostring(split(path, "/")[-2])
  | extend
      AccountName = tostring(split(ActorName, "@")[0]),
      UPNSuffix = tostring(split(ActorName, "@")[1]),
      PowerAutomateAppId = 27592,
      CloudAppId = 32780
  | project
      TimeGenerated,
      EventOriginalType,
      ActorName,
      EnvironmentId,
      AccountName,
      UPNSuffix,
      PowerAutomateAppId,
      CloudAppId,
      FlowId
eventGroupingSettings:
  aggregationKind: SingleAlert
entityMappings:
  - entityType: Account
    fieldMappings:
      - identifier: Name
        columnName: AccountName
      - identifier: UPNSuffix
        columnName: UPNSuffix
  - entityType: CloudApplication
    fieldMappings:
      - identifier: AppId
        columnName: PowerAutomateAppId
alertDetailsOverride:
  alertDisplayNameFormat: PowerAutomate - Terminated user {{EventOriginalType}} detected
  alertDescriptionFormat: '{{ActorName}} is on the terminated employees watchlist
    and carried out {{EventOriginalType}} in environment id {{EnvironmentId}}.'
customDetails:
  Environment: EnvironmentId
  FlowDetails: FlowId
version: 3.2.0

Stages and Predicates

Parameters

let query_frequency = 1h;

Stage 1: source

PowerAutomateActivity

Stage 2: where

| where TimeGenerated >= ago(query_frequency)

Stage 3: where

| where EventOriginalType in ("CreateFlow", "EditFlow")

Stage 4: join

| join kind=inner (MSBizAppsTerminatedEmployees()) on $left.ActorName == $right.UserPrincipalName

Stage 5: extend (4 consecutive steps)

| extend path = parse_url(FlowDetailsUrl).Path
| extend EnvironmentId = tostring(split(path, "/")[2])
| extend FlowId = tostring(split(path, "/")[-2])
| extend
    AccountName = tostring(split(ActorName, "@")[0]),
    UPNSuffix = tostring(split(ActorName, "@")[1]),
    PowerAutomateAppId = 27592,
    CloudAppId = 32780

Stage 6: project

| project
    TimeGenerated,
    EventOriginalType,
    ActorName,
    EnvironmentId,
    AccountName,
    UPNSuffix,
    PowerAutomateAppId,
    CloudAppId,
    FlowId

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
EventOriginalTypein
  • CreateFlow transforms: cased
  • EditFlow transforms: cased

Output fields

Fields the rule emits when it matches. Chronicle authors list these in the outcome block; they appear on the detection and $risk_score drives alerting. Sentinel / Defender XDR rules build them up through project / summarize / extend stages. Sentinel maps these into alert fields via entityMappings and customDetails; Defender XDR custom detections surface them as alert fields directly.

FieldSource
AccountNameproject
ActorNameproject
CloudAppIdproject
EnvironmentIdproject
EventOriginalTypeproject
FlowIdproject
PowerAutomateAppIdproject
TimeGeneratedproject
UPNSuffixproject