Skip to Content
Cowork (Agentic AI)Agent Audit Trail and Forensics Investigation

Agent Audit Trail and Forensics Investigation

TL;DR: This skill extracts CopilotInteraction audit records for Microsoft 365 Copilot and Copilot Studio agents from the Microsoft Purview unified audit log, then rebuilds the timeline of which agent ran, who prompted it and which resources it read, as a forensic report.

What does the agent audit trail and forensics investigation skill reconstruct?

When a security incident, suspected data breach, or legal hold involves an AI agent, the investigator needs to know which agent ran, which human prompted it, when, and which files, mails or chats it read to answer. Microsoft Learn documents that user interactions with Microsoft 365 Copilot, Cowork and Copilot Studio agents are logged automatically as part of Audit (Standard), under the single operation name CopilotInteraction, with the agent identified by its AgentId, AgentName and AppIdentity properties. This skill provides the query framework, the property map, and the reporting template to extract, correlate and present that evidence — and, just as importantly, to state plainly where the audit log is silent.

Audit properties this skill reads

PropertyWhat it gives the investigation
Operation / RecordType / WorkloadCopilotInteraction for Microsoft-developed Copilot apps; ConnectedAIAppInteraction for custom or registered third-party AI apps; AIAppInteraction for third-party AI apps not deployed in the organisation
AgentId, AgentName, AgentVersionIdentifies the agent — for example CopilotStudio.Declarative.<GUID> or CopilotStudio.CustomEngine.<GUID>
AppIdentityThe specific Copilot or AI application, structured as workloadName.appGroup.appName — for example Copilot.Studio.<AppId>
AppHostWhere the interaction happened: BizChat, Teams, Word, Outlook, SharePoint, and others
AccessedResourcesPer-resource ID, Name, SiteUrl, ListItemUniqueId, Type, SensitivityLabelId, Action (read, create, modify), PolicyDetails, Status (success or failure), and XPIADetected for a detected cross prompt injection attack
MessagesPrompt and response message ID, the IsPrompt flag, and JailbreakDetected
ContextsThe item or conversation the user was in during the interaction (ID, Type)
AISystemPluginPlugin name, ID and version; an Id of BingWebSearch means the response used the public web
ModelTransparencyDetailsModel provider, name and version where the scenario supplies them

What the unified audit log does not show

  • Microsoft Learn documents the CopilotInteraction operation for user interactions with Copilot and Copilot Studio agents, ConnectedAIAppInteraction and AIAppInteraction for third-party AI apps, and separate Facilitator operations (AINotesUpdate, LiveNotesUpdate, TeamCopilotMsgInteraction) for Teams AI Notes, Live Notes and meeting moderation — plus admin operations such as UpdateTenantSettings, CreatePlugin, DeletePlugin, CreatePromptBook, DeletePromptBook, DisableCopilotPlugin, DisablePromptBook and EnablePromptBook. Within that documented set there is no event for an agent taking an autonomous action, an approval or rejection of that action, or an agent sending a message outside the organisation. Do not build an exfiltration finding on an event type that Learn does not define.
  • An agent’s work on non-Microsoft systems is outside this log. Record that as a visibility gap in the report rather than as an absence of activity.
  • No session identifier is documented in the audit-copilot common-property schema. For Copilot Studio agents specifically, Learn’s Copilot Studio auditing page states the audited event carries a transcript thread ID, used to correlate to the separately stored chat transcript — the full prompt/response text itself is not in the audit event. Correlation is done on Messages.ID, Contexts.ID, the transcript thread ID (Copilot Studio agents), the user, the agent and the timestamps.

When should you run this skill?

  • “Investigate which files a Copilot agent read during an incident”
  • “Extract Copilot and agent interactions for a legal hold or eDiscovery request”
  • “Show me everything this agent was asked and what it read in the last 48 hours”
  • “Check whether an agent answered from a Highly Confidential document”
  • “Assemble agent interaction evidence for a privacy breach assessment”
  • “Show whether audit retention covers the investigation window”

How this skill works, step by step

  1. Confirm the review scope: agent name or AgentId, user UPN if investigating a person’s Copilot sessions, date range, and incident context.
  2. Confirm the window is still in retention before searching — see the retention table below. If the activity is older than the applicable retention period, the records are gone and no query will recover them.
  3. Open the Microsoft Purview portal and select Audit.
  4. Filter with the Activities – operation names field on CopilotInteraction (add ConnectedAIAppInteraction or AIAppInteraction where non-Microsoft AI apps are in scope), and use the RecordType and Workload filters to keep the result set to Copilot activity.
  5. Add a second search for configuration-change evidence, matched to the agent type in scope. For Microsoft 365 Copilot plugins and promptbooks, use the Copilot admin operations Learn lists under Microsoft 365 Copilot admin activities — UpdateTenantSettings, CreatePlugin, DeletePlugin, CreatePromptBook, DeletePromptBook, DisableCopilotPlugin, DisablePromptBook, EnablePromptBook and others. These do not cover Copilot Studio agent configuration: for that, use the separate Bot* operations Learn documents for Copilot Studio — BotCreate, BotDelete, BotUpdateOperation-BotNameUpdate, -BotAuthUpdate, -BotIconUpdate, -BotPublish, -BotShare, plus the BotComponent*, BotComponentCollection*, AIPluginOperation* and EnvironmentVariable* events. BotUpdateOperation-BotShare (sharing an agent to other users) is the event to check first in an exfiltration investigation.
  6. Set the date range to cover the investigation window. EDUC4TE’s practice is to add 24 hours either side; that margin is our method, not a Microsoft instruction.
  7. Export the results to CSV. Learn’s documented approach is to search and export by operation name first, then apply a filter on AppIdentity offline in the export; Learn does not describe a portal-side filter for this property. Use Excel Power Query to split the AuditData JSON into columns.
  8. Identify the agent in the export on AgentId, AgentName, AgentVersion and AppIdentity.
  9. Enumerate what was read: expand AccessedResources and keep Name, SiteUrl, Type, Action, Status and SensitivityLabelId for every entry.
  10. Resolve each SensitivityLabelId GUID to a label name with the Microsoft Graph sensitivityLabels API. The record already carries the resource name and URL, so no file-content permission is needed.
  11. Correlate prompt to response on Messages.ID and the IsPrompt flag; use Contexts and AppHost to place the interaction in the application the user was working in.
  12. Flag the integrity signals the schema does give you: JailbreakDetected on a prompt, XPIADetected on an accessed resource, PolicyDetails where access was blocked or restricted, Status of failure, and an AISystemPlugin.Id of BingWebSearch where the response drew on the public web.
  13. Apply the EDUC4TE anomaly heuristics below, then produce the timeline and summary.

EDUC4TE anomaly heuristics

These triage rules are EDUC4TE’s own method. Microsoft does not define them, and they carry no product meaning — treat each as a prompt to investigate, not a finding:

  • Interactions outside the user’s normal working hours.
  • Resources accessed from sites the user has no business reason to touch.
  • A labelled resource (particularly the organisation’s highest label) read by an agent whose stated purpose does not involve that data.
  • A spike in resources accessed per interaction against that agent’s own baseline.
  • JailbreakDetected or XPIADetected set anywhere in the window.

Output format

Agent interaction timeline

Sample rows are illustrative only — they are not real audit data.

Timestamp (UTC)OperationAgent (AgentName / AppIdentity)Initiated byResource read (AccessedResources)Sensitivity labelEDUC4TE anomaly flag
2026-06-10 02:14:37CopilotInteractionTravel-Booking-v2 / Copilot.Studio.<AppId>[email protected]Strategy2026.docx — /sites/ExecCommsHighly ConfidentialYes — outside working hours, site outside the user’s normal pattern
2026-06-10 02:14:52CopilotInteractionTravel-Booking-v2 / Copilot.Studio.<AppId>[email protected]ClientList.xlsx — /sites/Sales (XPIADetected: true)ConfidentialYes — prompt injection detected on an accessed resource

Forensic summary

  • Investigation window: [start] to [end], and whether it falls inside the applicable audit retention period
  • Agent(s) in scope: N
  • Total interactions: N
  • Resources read: N (by resolved label: N / N / no label: N)
  • Interactions with JailbreakDetected, XPIADetected or a blocking PolicyDetails: N
  • Interactions that used the public web (AISystemPlugin.Id = BingWebSearch): N
  • EDUC4TE heuristic flags raised: N
  • Visibility gaps to declare: agent activity on non-Microsoft systems; no documented audit event for autonomous agent actions or agent-sent external messages
  • Recommended escalation: [legal hold / privacy breach assessment / incident response team]

Scope and safety

Read-only with respect to tenant data. Searching and exporting the audit log does not change audit records or the resources they describe. This skill does NOT:

  • Modify, delete or suppress audit log records
  • Change audit configuration, retention policies or label policies
  • Disable or pause the agent under investigation — that is a separate, change-making task and is out of scope here
  • Contact users, agents or external parties

One caveat on the programmatic route: the Microsoft Purview Audit Search Graph API creates a query before returning results (POST /security/auditLog/queries), so the investigation leaves a saved query object in the tenant and consumes the tenant’s daily submission and concurrent-query allocation. The portal search tool is the lighter-touch option.

Licensing and permissions

Licences and add-ons

Capability usedWhat Microsoft Learn documents
Copilot, Cowork and agent user and admin audit records for Microsoft-developed Copilot appsLogged automatically as part of Audit (Standard), which is enabled by default with the appropriate subscription — no add-on is required to capture or search them. Learn is not fully consistent on where Copilot Studio sits: audit-copilot states custom applications built with Microsoft Copilot Studio and Microsoft Foundry are included in Audit (Standard), while audit-get-started’s Step 1 separately lists Microsoft Copilot Studio among the products requiring pay-as-you-go billing to audit non-Microsoft 365 AI data. Confirm against your own tenant’s billing configuration before relying on either reading for Copilot Studio specifically
Audit records for non-Microsoft AI applications (AIAppInteraction, and some ConnectedAiAppInteraction scenarios)Not included in the enterprise subscription — pay-as-you-go billing must be enabled; retained for 180 days
Default retention for Copilot records180 days in both Audit (Standard) and Audit (Premium). The Audit (Premium) one-year default applies only to records whose Workload is AzureActiveDirectory, Exchange, OneDrive or SharePoint
Retention beyond 180 days for Copilot recordsAudit (Premium) plus a custom audit log retention policy, up to one year
Ten-year retentionAudit (Premium), a per-user 10-Year Audit Log Retention add-on licence, and a matching retention policy. It is not retroactive — records generated before the policy exists are not covered
Records generated by non-user entities, such as service principal, system and application activitiesRetained for a fixed one year. This is not configurable and custom audit log retention policies do not apply to them
Audit (Premium) features and intelligent insightsAn appropriate E5 or add-on licence per user, with the Microsoft 365 Advanced Auditing service plan enabled for that user

EDUC4TE recommends holding at least 12 months of searchable Copilot audit history before relying on this skill for investigations. For Australian government organisations that is not only our view: Microsoft’s own ISM mapping records ISM-1988 (March 2025) as requiring event logs to be retained in a searchable manner for at least 12 months.

Least-privilege roles

  • View-Only Audit Logs role, granted by the Audit Reader role group on the Role groups page of the Microsoft Purview portal. Learn states that a member of Audit Reader can only search and export the audit log and cannot enable or disable audit logging — this is the read-only option for this task.
  • The Audit Logs role, granted by the Audit Manager role group, additionally manages tenant audit settings. An investigator does not need it, so do not request it for this skill.
  • Exchange admin center permissions are a separate matter: the View-Only Audit Logs and Audit Logs roles there grant access to the audit cmdlets, and the Audit Logs role there is what enables or disables auditing.
  • Do not substitute Compliance Administrator, Compliance Data Administrator, Information Protection Admin or Security Administrator. They are write-capable and none of them is documented as the least-privilege path to an audit search.

Microsoft Graph permissions

  • AuditLogsQuery.Read.All — read audit log data from all services through the Microsoft Purview Audit Search Graph API. Narrower per-service variants exist and are preferable where the scope allows: AuditLogsQuery-SharePoint.Read.All, AuditLogsQuery-OneDrive.Read.All, AuditLogsQuery-Exchange.Read.All, AuditLogsQuery-Entra.Read.All, AuditLogsQuery-Endpoint.Read.All, AuditLogsQuery-CRM.Read.All. The API is also published at the v1.0 Graph endpoint, so this permission can be used in production rather than only on /beta.
  • InformationProtectionPolicy.Read (delegated) or InformationProtectionPolicy.Read.All (application) — resolve sensitivity label GUIDs to label names. Learn marks these as the least-privileged permissions for listing sensitivity labels.
  • AuditLog.Read.All is not the permission for this task — it covers Microsoft Entra sign-in and directory audit logs, not the Purview unified audit log.
  • A file-read permission such as Files.Read.All is not required. AccessedResources already carries the resource Name, SiteUrl and SensitivityLabelId, and tenant-wide file read is far broader than this investigation needs.

Sources and compliance


Licensed under CC BY 4.0  by EDUC4TE .

SKILL.md— paste into Microsoft 365 Copilot or ClaudeDownload
▸ View skill file
How to use this skill
  1. Get the file. Download or copy the SKILL.md from the SKILL.md panel on this page.
  2. Load it into your host:
    • Microsoft 365 Copilot / Copilot Studio — add it as the instructions of a declarative agent or Copilot Studio agent.
    • Claude (Cowork / Claude Code) — drop the file into your skills folder; it loads as an Agent Skill automatically.
    • Any chat host — paste the file contents as your prompt.
  3. Grant read-only access. Assign the least-privilege roles and Microsoft Graph scopes listed in Licensing and permissions section of this article.
  4. Provide your tenant scope and run it (a site, a collection, or the whole tenant).
  5. Review the report and action the risk-ranked recommendations.

This skill is read-only by default — it inspects and reports, and never changes your tenant.

Get SKILL.md

Last reviewed 2026-10-06 · Published 2026-06-22

Last updated on