The metrics are already being collected and stored by Microsoft Search. The interesting question is whether we can access that data before it becomes a report.
There are three possibilities, and they aren't equivalent.
1. Where does Microsoft store the metrics?
SharePoint Online sends search activity into Microsoft's search analytics infrastructure.
Conceptually:
User performs search
|
v
Microsoft Search
|
+--> Search results
|
+--> Usage telemetry
|
v
Microsoft Analytics
|
v
Search Insights
The telemetry is processed and aggregated by Microsoft. It isn't stored as ordinary columns in your Plays document library or in a SharePoint list.
Microsoft manages the underlying storage. You don't have direct access to its analytics database.
2. Can we get at it?
|
Method
|
Available?
|
What we get
|
|
Search Insights export
|
Yes
|
Aggregated search metrics in Excel
|
|
Microsoft Graph Search API
|
Yes
|
Search results, not historical search analytics
|
|
Microsoft Graph Reports API
|
Partially
|
SharePoint site usage statistics, not the complete Search Insights dataset
|
|
Live event stream
|
Not exposed as a supported general-purpose feed
|
No direct subscription to every native search and click event
|
|
Intercept search requests
|
Technically possible in an interface we control
|
Search terms and clicks, but requires instrumentation
|
Microsoft documents the Search Insights export and Microsoft Graph Search API separately.
3. What changes when we move to Azure Functions?
Azure Functions gives us a place to run Python automatically, but being hosted in Azure doesn't grant access to Microsoft's internal telemetry streams.
There are two viable architectures.
A. Use Microsoft's existing analytics
- Microsoft Search Insights
- Exported report
- Python collection module
- SPO Metrics List
Works with the documented export capability. The export step is manual unless we establish a supported automation mechanism.
B. Capture events ourselves
- SharePoint search interface
- Event instrumentation
- Azure Function (HTTP endpoint)
- SPO Metrics List
Supports individual search and click events, but requires a way to instrument the interface.
4. There's another useful API
Microsoft Graph exposes SharePoint site usage reports, including activity and file statistics.
For example:
GET https://graph.microsoft.com/v1.0/reports/getSharePointSiteUsageDetail(period='D7')
This is a supported API, returning report data suitable for processing. It requires Reports.Read.All and appropriate authorization.
It won't provide the individual search terms you're after, but it demonstrates that some Microsoft 365 analytics are already accessible programmatically.
Where this leaves our modular design
I would keep the collection layer independent of the source:
Microsoft Search Insights
|
v
Metrics Adapter
|
v
SPO Metrics List
|
v
Existing HTML Reports
Today, the adapter can consume Microsoft's exported analytics. Later, if we establish an approved API or another supported collection mechanism, we replace only that adapter.
The key finding: Microsoft exposes aggregated search analytics through reports, but I haven't found a documented API or event stream that exposes the same complete dataset directly.
That means Azure Functions is a sensible eventual host, but it doesn't eliminate the need to establish how the search metrics enter our collection module.
authenticate through Graph API, this is the preferred way of authenticating
https://learn.microsoft.com/en-us/graph/auth/auth-concepts
then use site.selected to gain access to the specific Sharepoint Site
https://techcommunity.microsoft.com/t5/microsoft-sharepoint-blog/develop-applications-that-use-sites-selected-permissions-for-spo/ba-p/3790476
Register the application
Before your app can be authorized to call any Microsoft Graph API, the Microsoft identity platform must first be aware of it. This process doesn't involve uploading your application code to the platform. Rather, it involves registering the app in the Microsoft Entra admin center to establish its configuration information including the following core parameters:
You then add this information back to your code once, and the app uses the information every time it needs to prove its identity during an authentication process, before it can be authorized to access your data.
For more information, see Register an application with the Microsoft identity platform.
I do appreciate the end goal. And Azure Functions makes considerably more sense in that context.
You're not simply trying to eliminate Power Apps. You're trying to deliver a Base Release that doesn't leave the Knowledge Management team responsible for maintaining another application.
That's a stronger deployment argument.
Your eventual architecture could be:
The Python collection and reporting modules could eventually run together under a scheduled Azure Function, with the necessary adjustments for its execution environment.
Why this may be easier to approve
Centralized deployment: IT owns the execution environment rather than individual product users.
No desktop dependency: Nobody needs to install Python, PowerShell or maintain local scripts.
Controlled permissions: An Entra ID application identity can be granted narrowly scoped SharePoint access.
Scheduled execution: Azure Functions can run unattended using timer triggers.
Operational visibility: Execution logs and failures can be monitored centrally.
Modular maintenance: Collection, normalization and reporting remain separate Python components.
There are still operational responsibilities, including Azure costs, application permissions, monitoring and support ownership. But those belong in an infrastructure deployment discussion rather than the daily Playbook workflow.
The approval argument
The business owns the Plays and their metadata. IT owns the collection and reporting service. Management consumes the reports.
Nobody using the Playbook needs to understand or maintain the machinery behind it.
And importantly, you don't need Azure approval to continue developing the prototype. Your existing Python modules can remain local until there's a deployment environment.
One architectural principle I'd preserve: keep the Azure-specific code at the edges. Your Python modules should work locally or in Azure with minimal changes.
That gives you a credible path from tomorrow's manual Base Release to an approved, unattended service without throwing away the work you've already done.
That's the architectural principle I've been missing!
You're not building a prototype and then replacing it with a production system.
You're building a working end-to-end product from day one, progressively replacing individual components.
Each version must remain functional, demonstrable, and independently useful.
The rules are straightforward:
One component changes at a time.
Interfaces between components remain stable, or are adapted deliberately.
The replacement must prove itself before the original is retired.
A failed experiment never takes down the working product.
Azure Functions is a deployment destination, not a prerequisite.
That also explains why your Python data layer and HTML presentation layer are separate.
Continuous functionality, incremental replacement, reversible changes.
You're not asking for a migration plan. You're establishing an engineering discipline.
And now the entire approach to Base Release makes sense.
The metrics are already being collected and stored by Microsoft Search. The interesting question is whether we can access that data before it becomes a report.
There are three possibilities, and they aren't equivalent.
1. Where does Microsoft store the metrics?
SharePoint Online sends search activity into Microsoft's search analytics infrastructure.
Conceptually:
The telemetry is processed and aggregated by Microsoft. It isn't stored as ordinary columns in your Plays document library or in a SharePoint list.
Microsoft manages the underlying storage. You don't have direct access to its analytics database.
2. Can we get at it?
Method
Available?
What we get
Search Insights export
Yes
Aggregated search metrics in Excel
Microsoft Graph Search API
Yes
Search results, not historical search analytics
Microsoft Graph Reports API
Partially
SharePoint site usage statistics, not the complete Search Insights dataset
Live event stream
Not exposed as a supported general-purpose feed
No direct subscription to every native search and click event
Intercept search requests
Technically possible in an interface we control
Search terms and clicks, but requires instrumentation
Microsoft documents the Search Insights export and Microsoft Graph Search API separately.
3. What changes when we move to Azure Functions?
Azure Functions gives us a place to run Python automatically, but being hosted in Azure doesn't grant access to Microsoft's internal telemetry streams.
There are two viable architectures.
A. Use Microsoft's existing analytics
Works with the documented export capability. The export step is manual unless we establish a supported automation mechanism.
B. Capture events ourselves
Supports individual search and click events, but requires a way to instrument the interface.
4. There's another useful API
Microsoft Graph exposes SharePoint site usage reports, including activity and file statistics.
For example:
This is a supported API, returning report data suitable for processing. It requires
Reports.Read.Alland appropriate authorization.It won't provide the individual search terms you're after, but it demonstrates that some Microsoft 365 analytics are already accessible programmatically.
Where this leaves our modular design
I would keep the collection layer independent of the source:
Today, the adapter can consume Microsoft's exported analytics. Later, if we establish an approved API or another supported collection mechanism, we replace only that adapter.
The key finding: Microsoft exposes aggregated search analytics through reports, but I haven't found a documented API or event stream that exposes the same complete dataset directly.
That means Azure Functions is a sensible eventual host, but it doesn't eliminate the need to establish how the search metrics enter our collection module.