Forum Discussion
PowerBI Audit Activity events API - Scheduled RefreshDataset activity
- 1 year ago
Yes. Use GetGroupsAsAdmin to get the workspace then run AddUserAsAdmin for each. Pick you favourite scripting language of choice
Hi ledd_25
You're correct in identifying a key limitation in the Power BI REST APIs: while Get Activity Events provides audit-level activity logs, it does not capture scheduled refreshes that were successful, as these are not considered user-triggered actions. On the other hand, the Get Refresh History API does provide detailed refresh logs (including scheduled ones), but only for datasets in workspaces where the calling identity—like your service principal—has at least viewer access. Unfortunately, there is no out-of-the-box method to fetch refresh histories across all datasets in the entire tenant using a service principal unless that principal has explicit access to every workspace.
To overcome this, the most viable method is to programmatically assign your service principal (or an automation account) to each workspace with viewer or contributor access, run the Get Refresh History for all datasets, and then optionally remove the access afterward. This can be automated using the Power BI Admin APIs (Add Group User, List Groups, Get Datasets In Group, etc.), but it requires your service principal to have Power BI Admin API permissions and the Tenant.Read.All or Workspace.Read.All Graph permissions.
Alternatively, if you're a Power BI Service Administrator, you can consider setting up a custom logging solution using Power BI's audit logs via Microsoft Purview (formerly Compliance Center), which can log dataset refresh activity (including scheduled ones), though it comes with delays and more complex parsing.
In short, yes—temporarily granting your service principal access to all workspaces programmatically, then removing it post-extraction, is currently the most effective and scalable way to gather all scheduled refresh activity from across the organization.