How can I see all Power BI usage? (Part 2)

In Part 1, we covered options for pulling usage reports without interacting with an API. In this article, we will cover advanced techniques for pulling and storing Power BI user activity.
How can I see all Power BI usage? (Part 2)

In Part 1, we covered options for pulling usage reports without interacting with an API. These are helpful, but they still face these limitations:

  1. You don't get access to all the activity data.
  2. They don't give interaction level detail.
  3. There is no long-term data retention.

In this article, we will cover more advanced techniques for pulling and storing Power BI user activity.

Who this article is for

This article is intended primarily for Power BI administrators who need to see all Power BI usage. Knowledge of scripting or basic API interaction will be helpful. Examples will be provided in PowerShell, but any programming language can be used.

How this article is organized

We will start with the most generic tool to find Power BI - and all Microsoft 365 - logs. If you aren't familiar with it, it will be a good tool in your toolbox. We then move into a more specific tool for Power BI, the Power BI Activity Log. Finally, we will discuss the easiest way by far to collect and analyze all Power BI usage data - and retain it!

Introducing the Unified Audit Log (UAL)

For as long as Microsoft has offered Office as a cloud service, they have been logging events that happen in those tools. Around 2015, Microsoft brought all of these logs together into the "Unified Audit Log" to create a single place where all activities could be recorded.

Parsing the Microsoft branding

These days, "Office 365" is called "Microsoft 365" and the Unified Audit Log has been grouped under the "Microsoft Purview" umbrella, as a data governance, protection, and compliance solution.

Power BI is grouped into the Microsoft 365 umbrella and so participates in the UAL as well.

Search the UAL through a UI

If you have the right role in your organization, you can search these logs through web-based UI by visiting: https://compliance.microsoft.com/auditlogsearch.

💡
Note - if you don't have access to search the UAL, ask your Microsoft 365 administrator to grant you permissions to search. They can grant you limited permission to search the log without giving you any administrative permissions.

Once you are at this screen, you can go looking for Power BI logs by narrowing down on any field, but I would recommend either the "Record types" or "Workloads" as an easy filter.

The Unified Audit Log search screen
The Unified Audit Log search screen

This will launch an asynchronous search (hello Synapse!)

A queued job in the Unified Audit Log search screen
A queued job in the Unified Audit Log search screen

When done, the job status will change to "Completed".

A completed job in the Unified Audit Log search screen

And the results are viewable in this format. Exporting also takes a moment, but will result in a CSV format. Note that these audit logs are all contained in JSON objects, so even after you have the data downloaded in a file, you've still got quite a bit formatting to do. Still, for a one-off search, the UI can be useful.

Unified Audit Log search results

Search the UAL through script

Microsoft, and many others, have also developed helpful PowerShell cmdlets that can perform this search through code. A key cmdlet is Search-UnifiedAuditLog.

It's a good idea to check through a few settings in your Exchange Online settings before you start firing off searches, and you can read through those here.

Here's an example script usage that would to the same as our search above:

$auditlog = Search-UnifiedAuditLog -StartDate 09/15/2023 -EndDate 09/16/2023 -RecordType PowerBIAudit

And this script would write the results of that call into a CSV.

$auditlog | Select-Object -Property CreationDate,UserIds,RecordType,AuditData | Export-Csv -Path c:\AuditLogs\PowerShellAuditlog.csv -NoTypeInformation

Both of these are adapted from this article, which also gives tips on including these commands in a script.

Search the UAL through API

It's also entirely possible for you to access these Unified Audit Log events through the Office 365 Management Activity API. The biggest challenge with this, we find, is getting your authentication and secret management handled correctly. However, this opens up this data to any language and platform that needs to consume it.

Postman

For interacting with this or any other API, I highly recommend Postman! It's an easy to use API client that can keep all your work organized and has options for collaborating with a team. Often, you can find pre-built projects that are 80% configured to talk to the API you want.

💡
Pro tip: Use Postman to organize your API calls into Collections and leave yourself helpful notes. When you are trying to remember how you to interact with an API months later, it will be there ready for you to call again.

This blog from Sergei-Sergeev seems quite helpful if you choose to go this route: https://spblog.net/post/2021/11/02/configure-postman-to-be-easily-used-with-any-azure-ad-protected-api-sharepoint-graph-etc

The Power BI Activity Log API

Knowing that Power BI Administrators would want a limited focus, Microsoft released the Power BI Activity Log API in December 2019. It focuses the UAL on Power BI events only, plus it opens up those events to people with the Power BI Administrator role who may or may not also be Microsoft 365 admins.

It has no UI to search, but has options to use PowerShell and an API endpoint.

The Power BI Activity Log through PowerShell

With the right permissions, you can download events with the Get-PowerBIActivityEvent cmdlet.

Get-PowerBIActivityEvent -StartDateTime 2023-09-15T00:00:00 -EndDateTime 2023-09-16T00:00:00

This will give you very similar output as the UAL.

The Power BI Activity Log through API

In the Power BI Admin API, you can also access the Get Activity Events endpoint.

Here's a sample request to be equivalent to those we have done so far. You can optionally provide a filter argument to narrow down to specific users or activity types.

GET https://api.powerbi.com/v1.0/myorg/admin/activityevents?startDateTime='2023-09-15T00:00:00.000Z'&endDateTime='2023-09-16T00:00:00.000Z'

The output from this is, of course, all JSON.

Permissions needed for Power BI Activity Log

Note that, to use either of these commands, you must have some administrator privileges, namely, you have to either have the Office 365 Global administrator or. Power BI Service Administrator role or use a service principal.

Getting deep into details with Log Analytics (premium required)

If we need even more detail about what is going on in our reports and datasets, we can turn to a feature that became GA in May 2023, to integrate our Power BI Premium workloads with Azure Log Analytics. When enabled, the logs that are captured are the same as those that would be seen by connecting SQL Server Profiler to an active instance of SQL Server Analysis Services, with just a little more information about the exact workspace that the dataset is running in.

💡
Using Azure Log Analytics requires a workspace running on premium capacity.

In practice, this means that your logs will include query requests and query processing. The logs captured by Azure Log Analytics can include everything generated by these SQL Server Trace Events. Those query processing events have a lot of detail, even breaking down activities at the storage engine vs. formula engine internally, so be warned, the logs can grow large very quickly!

Can Azure Log Analytics give interaction level detail?

The trace events also include detailed information about the visual ID that requested them in their metadata. This means it is theoretically possible to understand, if now how many times a visual was viewed, at least how many times it was rendered and served. However, it only contains the GUID for that visual, and there's no trivial way to tie the GUIDs to your catalog of reports and visuals.

If enough interest is expressed, we will write a much more detailed article about setting up and using the Azure Log Analytics solution to get interaction-level detail. Hopefully this makes you aware of the user analytics capabilities possible with Log Analytics.

Buying a solution: Argus PBI User Activity

Finally, capturing all of this detail is hard. And once you get it, where do you store it? What if you miss some usage detail? How long to retain what you have? After all, you're a great script writer, but you've also got a job to do and questions to answer quickly.

That's where Argus PBI steps in to provide turnkey, whole-tenant monitoring for Power BI. You can check the product out at the link below. There are built-in Power BI reports to show you usage across your entire tenant. This data is retained for at least one year, and it costs way less than the time you would spend writing and maintaining all of your own scripts.

Screenshot of Argus PBI User Activity report
Argus PBI
Argus PBI: Whole-tenant monitoring for Power BI
Disclaimer: Greg and Brent are founding partners of Argus PBI.

Simplify Power BI Operations, Governance, and Administration

Power BI Ops

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to Power BI Ops.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.