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
| Property | What it gives the investigation |
|---|---|
Operation / RecordType / Workload | CopilotInteraction 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, AgentVersion | Identifies the agent — for example CopilotStudio.Declarative.<GUID> or CopilotStudio.CustomEngine.<GUID> |
AppIdentity | The specific Copilot or AI application, structured as workloadName.appGroup.appName — for example Copilot.Studio.<AppId> |
AppHost | Where the interaction happened: BizChat, Teams, Word, Outlook, SharePoint, and others |
AccessedResources | Per-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 |
Messages | Prompt and response message ID, the IsPrompt flag, and JailbreakDetected |
Contexts | The item or conversation the user was in during the interaction (ID, Type) |
AISystemPlugin | Plugin name, ID and version; an Id of BingWebSearch means the response used the public web |
ModelTransparencyDetails | Model provider, name and version where the scenario supplies them |
What the unified audit log does not show
- Microsoft Learn documents the
CopilotInteractionoperation for user interactions with Copilot and Copilot Studio agents,ConnectedAIAppInteractionandAIAppInteractionfor third-party AI apps, and separate Facilitator operations (AINotesUpdate,LiveNotesUpdate,TeamCopilotMsgInteraction) for Teams AI Notes, Live Notes and meeting moderation — plus admin operations such asUpdateTenantSettings,CreatePlugin,DeletePlugin,CreatePromptBook,DeletePromptBook,DisableCopilotPlugin,DisablePromptBookandEnablePromptBook. 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-copilotcommon-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 onMessages.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
- Confirm the review scope: agent name or
AgentId, user UPN if investigating a person’s Copilot sessions, date range, and incident context. - 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.
- Open the Microsoft Purview portal and select Audit.
- Filter with the Activities – operation names field on
CopilotInteraction(addConnectedAIAppInteractionorAIAppInteractionwhere non-Microsoft AI apps are in scope), and use theRecordTypeandWorkloadfilters to keep the result set to Copilot activity. - 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,EnablePromptBookand others. These do not cover Copilot Studio agent configuration: for that, use the separateBot*operations Learn documents for Copilot Studio —BotCreate,BotDelete,BotUpdateOperation-BotNameUpdate,-BotAuthUpdate,-BotIconUpdate,-BotPublish,-BotShare, plus theBotComponent*,BotComponentCollection*,AIPluginOperation*andEnvironmentVariable*events.BotUpdateOperation-BotShare(sharing an agent to other users) is the event to check first in an exfiltration investigation. - 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.
- Export the results to CSV. Learn’s documented approach is to search and export by operation name first, then apply a filter on
AppIdentityoffline 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. - Identify the agent in the export on
AgentId,AgentName,AgentVersionandAppIdentity. - Enumerate what was read: expand
AccessedResourcesand keepName,SiteUrl,Type,Action,StatusandSensitivityLabelIdfor every entry. - Resolve each
SensitivityLabelIdGUID to a label name with the Microsoft GraphsensitivityLabelsAPI. The record already carries the resource name and URL, so no file-content permission is needed. - Correlate prompt to response on
Messages.IDand theIsPromptflag; useContextsandAppHostto place the interaction in the application the user was working in. - Flag the integrity signals the schema does give you:
JailbreakDetectedon a prompt,XPIADetectedon an accessed resource,PolicyDetailswhere access was blocked or restricted,Statusoffailure, and anAISystemPlugin.IdofBingWebSearchwhere the response drew on the public web. - 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.
JailbreakDetectedorXPIADetectedset anywhere in the window.
Output format
Agent interaction timeline
Sample rows are illustrative only — they are not real audit data.
| Timestamp (UTC) | Operation | Agent (AgentName / AppIdentity) | Initiated by | Resource read (AccessedResources) | Sensitivity label | EDUC4TE anomaly flag |
|---|---|---|---|---|---|---|
| 2026-06-10 02:14:37 | CopilotInteraction | Travel-Booking-v2 / Copilot.Studio.<AppId> | [email protected] | Strategy2026.docx — /sites/ExecComms | Highly Confidential | Yes — outside working hours, site outside the user’s normal pattern |
| 2026-06-10 02:14:52 | CopilotInteraction | Travel-Booking-v2 / Copilot.Studio.<AppId> | [email protected] | ClientList.xlsx — /sites/Sales (XPIADetected: true) | Confidential | Yes — 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,XPIADetectedor a blockingPolicyDetails: 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 used | What Microsoft Learn documents |
|---|---|
| Copilot, Cowork and agent user and admin audit records for Microsoft-developed Copilot apps | Logged 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 records | 180 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 records | Audit (Premium) plus a custom audit log retention policy, up to one year |
| Ten-year retention | Audit (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 activities | Retained 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 insights | An 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) orInformationProtectionPolicy.Read.All(application) — resolve sensitivity label GUIDs to label names. Learn marks these as the least-privileged permissions for listing sensitivity labels.AuditLog.Read.Allis 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.Allis not required.AccessedResourcesalready carries the resourceName,SiteUrlandSensitivityLabelId, and tenant-wide file read is far broader than this investigation needs.
Related skills
- Governing AI Agents in Microsoft 365: Start here for the agent governance sequence this investigation supports.
- Entra Agent ID Audit: Run before, to list agent identities and spot agents with no accountable sponsor.
- Audit Log Retention and Coverage Validator: Run before, to confirm the unified audit log is on and retention covers the window.
- Admin Action and Audit Trail Review: Run alongside, to review privileged admin events including agent and plugin configuration changes.
- Copilot Interaction Compliance Audit: Run after, to find where Copilot prompts and responses touched sensitive data.
Sources and compliance
- Audit logs for Copilot and AI applications (Microsoft Learn) — the
CopilotInteractionoperation, the common property schema, the AppHost values, offlineAppIdentityfiltering, and Audit (Standard) coverage for Microsoft apps including Copilot Studio. - Audit Copilot Studio activities in Microsoft Purview (Microsoft Learn) — the
Bot*,BotComponent*andAIPluginOperation*agent-configuration operations, and the transcript thread ID carried on theCopilotInteractionevent for Copilot Studio agents. - Audit log activities (Microsoft Learn) — the full set of Microsoft 365 Copilot admin operations, including
CreatePromptBook,DeletePromptBook,DisableCopilotPluginandDisablePromptBook. - Learn about auditing solutions in Microsoft Purview (Microsoft Learn) — Audit (Standard) and Audit (Premium) capability comparison, 180-day default retention, one-year and ten-year retention, the non-user-entity retention footnote, CSV export, and the
Search-UnifiedAuditLogcmdlet. - Get started with auditing solutions (Microsoft Learn) — the View-Only Audit Logs and Audit Logs roles, the Audit Reader and Audit Manager role groups, Exchange admin center permissions, the Advanced Auditing service plan, and the Step 1 pay-as-you-go billing requirement that lists Microsoft Copilot Studio.
- Roles and role groups in Microsoft Defender for Office 365 and Microsoft Purview (Microsoft Learn) — the write-capable scope of the Compliance Administrator, Compliance Data Administrator, Information Protection Admin and Security Administrator role groups, cited here to support excluding them from this skill’s least-privilege path.
- Create auditLogQuery (Microsoft Graph v1.0, Microsoft Learn) —
AuditLogsQuery.Read.All,AuditLogsQuery-Entra.Read.Alland the other per-service variants, thePOST /security/auditLog/queriespattern, and the tenant submission and concurrency limits. The same operation is also published under the Microsoft Graph/betaendpoint. - List sensitivityLabels (Microsoft Graph beta, Microsoft Learn) —
InformationProtectionPolicy.ReadandInformationProtectionPolicy.Read.Allas the least-privileged permissions for label lookups. - Audit log considerations for the Australian Government (Microsoft Learn) — ISM-1988 (12 months searchable retention) and ISM-1989 (AFDA Express retention classes) as Microsoft maps them to Microsoft 365 audit logging.
- Australian Government Information Security Registered Assessor Program (IRAP) (Microsoft Learn) — IRAP as the ACSC-administered independent assessment of a system against ISM controls, and the division of responsibility between Microsoft’s assessment and your own.
- Thresholds, anomaly heuristics and the 12-month retention recommendation on this page are EDUC4TE’s method, not Microsoft guidance.
- Pair with Admin Audit Trail Review for a complete audit assurance picture.
Licensed under CC BY 4.0 by EDUC4TE .
SKILL.md— paste into Microsoft 365 Copilot or ClaudeDownload▸ View skill file▾ Hide skill file
How to use this skill
- Get the file. Download or copy the
SKILL.mdfrom the SKILL.md panel on this page. - 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.
- Grant read-only access. Assign the least-privilege roles and Microsoft Graph scopes listed in Licensing and permissions section of this article.
- Provide your tenant scope and run it (a site, a collection, or the whole tenant).
- 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.
Last reviewed 2026-10-06 · Published 2026-06-22