← Back to SOC feed Coverage →

Copilot Studio AI Agents - Published Dormant (30d)

kql MEDIUM Azure-Sentinel
CloudAppEvents
backdoorcredential-thefthuntingmicrosoftofficial
This rule was pulled from an open-source repository and enriched with AI. Validate in a test environment before deploying to production.
View original rule at Azure-Sentinel →
Retrieved: 2026-04-21T09:00:00Z · Confidence: medium

Hunt Hypothesis

Adversaries may publish dormant Copilot Studio AI agents to maintain persistent access or exfiltrate data undetected. SOC teams should proactively hunt for these agents in Azure Sentinel to identify and mitigate potential long-term threats and reduce unnecessary exposure.

KQL Query

let ActiveAgents =
    CloudAppEvents
    | where Timestamp > ago(30d)
    | where ActionType == "CopilotInteraction"
    | where RawEventData.AppIdentity startswith "Copilot.studio"
    | extend AppIdentity = iff(isnotempty(RawEventData.CopilotEventData.AppIdentity), RawEventData.CopilotEventData.AppIdentity, RawEventData.AppIdentity)
    | extend AgentName = extract(@"[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}-(.*)$", 1, tostring(AppIdentity))
    | where isnotempty(AgentName)
    | distinct AgentName;
AIAgentsInfo
| where RegistrySource != "A365"
| where AgentCreationTime > ago(30d)
| summarize arg_max(Timestamp, *) by AIAgentId
| where AgentStatus != "Deleted"
| where AgentStatus == "Published"
| extend AgentName2 = tostring(todynamic(RawAgentInfo)['Bot']['Attributes']['schemaname'])
| where isnotempty(AgentName2)
| where AgentName2 !in (ActiveAgents)
| project-reorder AgentCreationTime, AIAgentId, AIAgentName, AgentStatus, CreatorAccountUpn, OwnerAccountUpns

Analytic Rule Definition

id: 5e8f1a2b-3c4d-5e6f-7a8b-9c0d1e2f3a4b
name: Copilot Studio AI Agents - Published Dormant (30d)
description: |
  This query identifies Copilot Studio AI agents that are published but have not been used by any user in the organization for the last 30 days. 
  Dormant agents can create unnecessary exposure and may still hold active connections or credentials, which could become a security risk if left unmanaged. 
  They also increase clutter and make it harder to maintain a clean, efficient environment.
  Recommended Action: Review these agents to confirm whether they are still needed. If not, consider unpublishing or removing them. 
  If they are required, validate their configuration and ensure they follow security best practices before reactivation.
requiredDataConnectors: []
tactics: []
relevantTechniques: []
query: |
  let ActiveAgents =
      CloudAppEvents
      | where Timestamp > ago(30d)
      | where ActionType == "CopilotInteraction"
      | where RawEventData.AppIdentity startswith "Copilot.studio"
      | extend AppIdentity = iff(isnotempty(RawEventData.CopilotEventData.AppIdentity), RawEventData.CopilotEventData.AppIdentity, RawEventData.AppIdentity)
      | extend AgentName = extract(@"[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}-(.*)$", 1, tostring(AppIdentity))
      | where isnotempty(AgentName)
      | distinct AgentName;
  AIAgentsInfo
  | where RegistrySource != "A365"
  | where AgentCreationTime > ago(30d)
  | summarize arg_max(Timestamp, *) by AIAgentId
  | where AgentStatus != "Deleted"
  | where AgentStatus == "Published"
  | extend AgentName2 = tostring(todynamic(RawAgentInfo)['Bot']['Attributes']['schemaname'])
  | where isnotempty(AgentName2)
  | where AgentName2 !in (ActiveAgents)
  | project-reorder AgentCreationTime, AIAgentId, AIAgentName, AgentStatus, CreatorAccountUpn, OwnerAccountUpns
entityMappings:
  - entityType: Account
    fieldMappings:
      - identifier: FullName
        columnName: CreatorAccountUpn
  - entityType: Host
    fieldMappings:
      - identifier: HostName
        columnName: AIAgentName
version: 1.0.0

Required Data Sources

Sentinel TableNotes
CloudAppEventsEnsure this data connector is enabled

References

False Positive Guidance

Original source: https://github.com/Azure/Azure-Sentinel/blob/main/Hunting Queries/AI Agents/Copilot Studio Connector/PublishedDormantAIAgents.yaml