b) Then select Audit tab, select date range and click search, then click Export to export the audit log to CSV file.
Part 2: Export activity logs.
(1) Use PowerShell.
Please run the following code in PowerShell to install the module, login to Power BI, and export the activity logs. In the export log section, you can add filters, date range, file storage path, etc. You can check the documentation for more details.
#Install Administrator Module (running as administrator)
You can't sign into the Power BI portal by using service principal.
Power BI admin rights are required to enable service principal in the Admin API settings in the Power BI admin portal.
The results of this basic API are returned on an hourly basis, so we need to get the next set of audit activity events by sending the continuation token to the API. The continuation token can be found in the response of the API.
#Run Get Activity Events API.
# Get the continuation token shown above and Send the continuation token to get the next set of audit activity events.
(3) Use the Power BI API (Beta) custom connector.
PowerShell can only export activity logs for one day at a time, so if you want to get the activity logs for a period, you can try the Power BI API (Beta) connector.
b) Place the connector. mez file in the [Documents]\Power BI Desktop\Custom Connectors folder. If this folder does not exist, create it.
In my example, the full path is “C:\Users\Administrator\Documents\Power BI Desktop\Custom Connectors folder”.
c) In Power BI Desktop, select File > Options and settings > Options > Security. Under Data Extensions, select (Not Recommended) Allow any extension to load without validation or warning. Click OK, and restart Power BI Desktop.
d) Launch Power BI Desktop and find the Power BI API (Beta) connector.
e) After authenticating, go to the functions folder in the Navigator window and look for "Event Activity Log”.
f) Enter a date range for the event activity logs. Then click the Invoke button and you can start querying the data from the API.