Scripts · PowerShell

Export-CopilotInteractions

Export user-level Copilot prompts and responses from Microsoft Graph into analysis-ready CSV datasets.

View on GitHub

What it is

A PowerShell exporter for Microsoft 365 Copilot enterprise interaction history that writes normalized interactions, users, errors, and pre-aggregated usage CSVs.

Why use it

  • Feed Power BI, Excel, or another analytics tool with user-level interaction data.
  • Use interactive, client-secret, or certificate authentication.
  • Handle throttling, per-user failures, SKU tiers, and app/feature normalization during export.

How to use it

Install Microsoft.Graph.Authentication, grant the documented Graph permissions, and test interactively:

.\Export-CopilotInteractions.ps1 -TenantId "contoso.onmicrosoft.com" -Interactive -MaxUsers 10

Review Errors.csv, then remove the user cap for the full export.

Prerequisites

  • PowerShell 5.1 or later
  • Microsoft.Graph.Authentication module
  • User.Read.All, Reports.Read.All, and AiEnterpriseInteraction.Read.All
  • Entra app registration for app-only authentication