Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Lorenz33
Helper III
Helper III

Track Power BI user activities with Activity Log

We have a necessity to track user access to specific reports on our Power BI instance. According to the this article, we can use the activity log to retrieve tracking/audit information for a Power BI instance.

 

Track user activities in Power BI - Power BI | Microsoft Learn

 

In the process of researching and learning, I have been trying REST APIs with Powershell. I have been able to call straightforward REST APIs such as the ones that return all of the datasets. I have been using an account that is a Power BI Administrator and I have installed all of the required Power BI Cmdlets in Powershell.

 

However, I  have not  had any success with calling the API to retrieve tracking information. For a simple test the article shows this command:

https://api.powerbi.com/v1.0/myorg/admin/activityevents?startDateTime='2019-08-31T00:00:00'&endDateT...

 

I  have tried calling it in Powershell using this command:

Invoke-PowerBIRestMethod -Url 'https://api.powerbi.com/v1.0/myorg/admin/activityevents?startDateTime='2023-02-10T00:00:00'&endDateT...'' -Method Get

 

It fails with this message:

Invoke-PowerBIRestMethod : A positional parameter cannot be found that accepts argument
'2023-02-10T00:00:00&endDateTime=2023-02-12T23:59:59'

 

I then tired this command:

Invoke-PowerBIRestMethod -Url 'https://api.powerbi.com/v1.0/myorg/admin/activityevents?startDateTime=2023-02-10T00:00:00&endDateTim...' -Method Get

I then got this message:

"code": "BadRequest", "message": "Bad Request",

"The DateTimeOffset text '2023-02-10T00:00:00' should be in format
'yyyy-mm-ddThh:mm:ss('.'s+)?(zzzzzz)?' and each field value is within valid range.",
"target": "startDateTime"

 

Lastly, I tried this command:

Invoke-PowerBIRestMethod -Url 'https://api.powerbi.com/v1.0/myorg/admin/activityevents?startDateTime=2023-02-10T00:00:00.000Z&endDa...' -Method Get

 

I then get this message:

Invoke-PowerBIRestMethod : Encountered errors when invoking the command: {"code": "BadRequest", "message": "Bad Request", "details": [{
"message": "Object must implement IConvertible

 

Can anyone give the correct syntax to call the Power BI REST API to show the activith from Feb. 10, 2023 - Feb. 12, 2023? Once we have this simple step done we would like to move forward with getting a continuation token and autmating the process with SSIS.

2 REPLIES 2
Lorenz33
Helper III
Helper III

I am just bumping this up. Maybe the original post is too wordy.

 

What I need is help accessing the Power BI Activity in order to retrieve audit/tracking data on who is accessing the reports, duration, frequenecy, etc. This article says we can do that using Power BI REST APIs.

 

https://learn.microsoft.com/en-us/power-bi/admin/service-admin-auditing

 

Her is info  on the Power BI Get Activity Events REST APIs.

 

Admin - Get Activity Events - REST API (Power BI Power BI REST APIs) | Microsoft Learn

 

How do I run them from Powershell? I have been trying running the following command:

 

Invoke-PowerBIRestMethod -Url 'https://api.powerbi.com/v1.0/myorg/admin/activityevents?startDateTime=2023-02-10T00:00:00.000Z&endDa...' -Method Get

 

However, it fails. I have tried adding single quotations around the dates but it just adds it into one big string from the start date to the end date and fails. I have tried removing the .000Z from the end of the dates but it gives a date format error.

 

Any help would be appreciated.

Heyyy,

 

Did you manage to solve this issue? 

Can you please, provide more information about this topic?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.