Queries for the LLMActivity table

For information on using these queries in the Azure portal, see Log Analytics tutorial. For the REST API, see Query.

Copilot Interactions by User

Shows Copilot interactions grouped by user with counts and time range over the last 7 days

LLMActivity
| where RecordType == "CopilotInteraction"
| where TimeGenerated >= ago(7d)
| summarize InteractionCount = count(), 
            FirstInteraction = min(TimeGenerated),
            LastInteraction = max(TimeGenerated)
            by ActorName, ActorUserId
| order by InteractionCount desc

Copilot Plugin Management Activity

Shows plugin creation, updates, and status changes over the last 30 days

LLMActivity
| where RecordType in ("CreateCopilotPlugin", "UpdateCopilotPlugin", "EnableCopilotPlugin", "DisableCopilotPlugin")
| where TimeGenerated >= ago(30d)
| project TimeGenerated, ActorName, RecordType, AgentName, SrcIpAddr
| order by TimeGenerated desc

Copilot PromptBook Management

Tracks PromptBook creation, updates, and deletions over the last 30 days

LLMActivity
| where RecordType in ("CreateCopilotPromptBook", "UpdateCopilotPromptBook", "DeleteCopilotPromptBook")
| where TimeGenerated >= ago(30d)
| extend PromptBookId = tostring(LLMEventData.Resource[0].Property)
| project TimeGenerated, ActorName, RecordType, PromptBookId, SrcIpAddr
| order by TimeGenerated desc

Copilot Security and Compliance Events

Shows security-related Copilot events including jailbreak detection over the last 7 days

LLMActivity
| where RecordType == "CopilotInteraction"
| where TimeGenerated >= ago(7d)
| extend Messages = LLMEventData.Messages
| mv-expand Messages
| where tobool(Messages.JailbreakDetected) == true
| project TimeGenerated, ActorName, ActorUserId, AgentName, 
          MessageId = tostring(Messages.Id),
          JailbreakDetected = tobool(Messages.JailbreakDetected)
| order by TimeGenerated desc

AI Model Usage Statistics

Shows which AI models are being used across Copilot interactions over the last 30 days

LLMActivity
| where RecordType == "CopilotInteraction"
| where TimeGenerated >= ago(30d)
| where isnotempty(AIModelName)
| summarize InteractionCount = count(),
            UniqueUsers = dcount(ActorUserId),
            FirstUsed = min(TimeGenerated),
            LastUsed = max(TimeGenerated)
            by AIModelName, AIModelVersion
| order by InteractionCount desc

Resources Accessed by Copilot

Shows external resources accessed during Copilot interactions over the last 7 days

LLMActivity
| where RecordType == "CopilotInteraction"
| where TimeGenerated >= ago(7d)
| extend AccessedResources = LLMEventData.AccessedResources
| mv-expand AccessedResources
| where isnotempty(AccessedResources.SiteUrl)
| project TimeGenerated, ActorName, AgentName,
          ResourceUrl = tostring(AccessedResources.SiteUrl),
          Action = tostring(AccessedResources.Action),
          ResourceType = tostring(AccessedResources.Type)
| summarize AccessCount = count() by ResourceUrl, Action, ResourceType
| order by AccessCount desc