Docs menuMicrosoft Purview audit

Docs Integrations

Microsoft Purview audit

Bring the Copilot and agent records from your Microsoft 365 audit log — what agents did, and what Agent 365 guardrails decided — into your Runback audit log, sealed and checkable offline. About fifteen minutes in the Entra admin center.

Microsoft 365 keeps an audit log of what people and agents do, including Copilot, Copilot Studio agents and Agent 365. This connector reads that log for you and copies the AI records into Runback, where each one is sealed in your audit log next to everything else Runback records.

It brings two kinds of record, and keeps them apart:

  • Guardrail decisions. When an Agent 365 AI guardrail checks an agent's request or response, Microsoft records what it decided: block, audit, allow, warn or modify. Each is sealed as decided by a Microsoft Agent 365 guardrail, recorded by Microsoft, sealed on receipt by Runback. Only a block counts as a stopped call.
  • Activity. Everything else (a person using Copilot, an agent being invoked or calling a tool, an agent being created or changed) is Microsoft's record of what happened, not a decision. Each is sealed as recorded by Microsoft Purview, sealed on receipt by Runback.

Runback never presents either as its own decision.

Two Microsoft records, as Runback seals them
Two example audit records, and what Runback seals from each
Microsoft sendsRunback seals
Copilot interactionCopilotInteraction, record 99b0a960…activity: CopilotInteraction
WhoUserKey 12d24f71… (admin@contoso.onmicrosoft.com)Regular, 12d24f71…
When2023-12-13T17:12:36 (UTC)2023-12-13T17:12:36.000Z
Recorded byMicrosoft Purview auditrecorded by Microsoft Purview, sealed on receipt by Runback
Guardrail decisionDecisionType 0 (block)decision: deny
Which guardrailExampleProvider / PII guard, PII_DETECTEDagent365:ExampleProvider/PII guard:PII_DETECTED
Decided byAgent 365 guardraildecided by a Microsoft Agent 365 guardrail, recorded by Microsoft, sealed on receipt by Runback

These are examples, not anyone's data. The Copilot record is the one in Microsoft's documentation. The right-hand column is what the connector's own code produces.

How the records get to Runback

Microsoft offers the audit log through the Office 365 Management Activity API, which is read with an app you register in your own tenant.

  1. You register an app in Microsoft Entra ID that can read the audit log, and give Runback its IDs and a client secret.
  2. Runback checks them with Microsoft, turns on the audit feed for general workloads if it is not on already, and stores the secret encrypted.
  3. Every five minutes Runback asks Microsoft for new audit content, keeps the Copilot and agent records, and leaves the rest.
  4. Each record is sealed into your audit log within about two minutes.

Collection starts when you connect. Records from before that are not collected. If Runback had to turn the feed on, Microsoft can take up to 12 hours to make the first records available.

Before you begin

  • Auditing turned on for your Microsoft 365 organization. It is on by default.
  • The role to register an app and grant admin consent in Microsoft Entra ID, for example Global Administrator.
  • An owner or admin role in Runback.

The permission this needs, ActivityFeed.Read, reads your organization's whole audit log, not only the AI part. Runback reads the general workloads feed and keeps only Copilot, AI app and agent records; nothing else is stored. Use an app that does only this.

Steps

  1. Register an app for Runback

    In the Microsoft Entra admin center, open App registrations, choose New registration, name it Runback audit reader, keep Accounts in this organizational directory only, and register it. Copy the Application (client) ID and the Directory (tenant) ID from its overview.

    Expected output
    The app's overview page shows both IDs.
  2. Give it permission to read the audit log

    In the app, open API permissions, choose Add a permission, then Office 365 Management APIs, then Application permissions, and select ActivityFeed.Read. Then choose Grant admin consent for your organization.

    Expected output
    ActivityFeed.Read is listed with the status "Granted".
  3. Create a client secret

    Open Certificates & secrets, choose New client secret, and add it. Copy its Value straight away; it is shown once. Note when it expires.

    Expected output
    You have the tenant ID, the client ID and the secret value.
  4. Connect it in Runback

    In Runback, open Settings › Keys and access › Microsoft Purview audit (Copilot and agents), enter the three values, and choose Connect.

    Expected output
    The card says it is connected and shows the tenant and app IDs. If Microsoft rejects the app, Runback says why and stores nothing.
  5. Check records arrive

    Use Copilot, or run an agent. Microsoft makes audit records available after a delay it does not fix, and the first ones after the feed is turned on can take up to 12 hours. The same card shows how many guardrail decisions and activity records have arrived.

What Runback records

For a guardrail decision, one decision with:

  • Decision: deny for block, allow, warn, modify, or shadow:audit for audit, which Microsoft describes as recorded without blocking. Only deny is counted as stopped.
  • Rule: the guardrail's provider and name, and its decision code, as agent365:<provider>/<guardrail>:<code>.
  • Policy: the policy ID and version, or the guardrail's own ID and version when no policy is named.
  • Span: the trace and span IDs, so you can find the same check in your traces.
  • Time: when Microsoft recorded it, in UTC.

The guardrail's findings and its written reason are not kept.

For activity, one record with Microsoft's operation name (for example CopilotInteraction or AIExecuteTool), the kind of user or app, its stable user key (never the sign-in email), the agent ID when Microsoft includes one, the time, and the whole audit record: every field Microsoft sent, kept as canonical JSON (RFC 8785: keys sorted, no extra spaces) and sealed by the SHA-256 hash of that text. Hashing the raw bytes of Microsoft's response will not give the same hash; canonicalize the record first. The whole record can include the user's sign-in name and IP address.

Microsoft can send the same record more than once. Runback keeps one copy and counts the rest as duplicates.

Checking a record offline

Each record is proved by its Microsoft audit record ID (the Id in the audit record), with your Runback API key: a guardrail decision from GET /api/ledger/decisions/:id?source=microsoft_purview, activity from GET /api/ledger/activities/:id?source=microsoft_purview. Save the answer and check it with @runback/verify 3.3 or later:

Examplebash
npx @runback/verify@3.3 proof.json

Limits

  • Runback seals what Microsoft's API returns. It does not check the records any other way.
  • Microsoft keeps audit content available for 7 days. If Runback falls further behind than that (for example after a long outage, or an expired secret), the time it could not collect is shown on the card. It is never skipped silently.
  • Each poll reads up to 40 content files and up to a day of listings. A busy tenant catches up over the next polls.
  • When the client secret expires, collection stops and the card shows the error. Create a new secret and choose Replace; Runback resumes from where it stopped.
  • Only the commercial Microsoft 365 cloud (manage.office.com) is supported. Government clouds are not.
  • Signing in with a certificate instead of a client secret is not supported yet.
  • A record without an ID or a time, a guardrail record whose decision Runback cannot read, or a record larger than 256 KB, is refused, never guessed or cut short. The card shows how many have been refused.
  • Disconnect deletes the secret and stops polling. The audit feed subscription in Microsoft is left on, because other tools may use it. Records already received stay sealed.

For your developer

The connector is a poll, not an endpoint you call. It gets an app-only token with the client-credentials grant for https://manage.office.com/.default, lists Audit.General content an hour at a time, fetches each content file, and keeps records whose type or workload is Copilot, AI app or Agent 365. It sends the token only to manage.office.com, under your tenant's own feed. The secret is stored with AES-256-GCM under EVIDENCE_CONNECTOR_SECRET_KEY. The fields read, and every assumption about Microsoft's records, are listed in web/lib/connectors/microsoftPurview.ts.

Microsoft references: the Management Activity API, registering the app, the audit record schema, including Agent 365's AI Guardrail, Copilot audit records, audited activities, including Agent 365, the client-credentials grant.

Last updated 19 Nov 2026.