When the brand new Energy BI service exercise logging API was introduced over the vacations, I used to be intrigued and anxious to begin working with it. I’ve had some expertise with report utilization monitoring utilizing the present Workplace logs and utilization metric studies that do present some helpful data however could be a chore to make use of. Exercise monitoring and troubleshooting with the brand new logging API is concentrated solely on Energy BI tenant occasions like dashboard, interactive and paginated studies views, deployments, errors and information refresh occasions. This ought to be simpler than earlier than, enabling admins to be extra proactive by monitoring utilization patterns. In a brief collection of weblog posts, I’ll reveal how one can construct a whole exercise logging and reporting answer in your total Energy BI tenant. On this first put up of the collection, we’ll simply get began with the fundamentals by capturing just some log occasions for a short window of exercise and floor them in a easy report.
Earlier than we get began,
a short historical past lesson is on order:
When the Energy BI cloud-based service was initially supplied again in 2013 as a function extension to Workplace 365, it used SharePoint On-line because the storage structure. Some extra logging occasions have been added to the present and quite a few Workplace 365 occasions catalog. It has all the time been cumbersome to search out related reporting data amid the entire different noise in these logs. Elements of the Energy BI back-end providers have since been migrated right into a extra specialised service infrastructure however the exercise logging has remained in Workplace 365 till December of 2019. The Workplace logs required particular privileges inside the Workplace tenant and produced volumes of occasion information associated solely to folders, information and Workplace paperwork.
The new Power BI Activity Log API is specially-suited and optimized only for Energy BI. Against this, it will likely be a lot simpler to identification and observe related service and person exercise for workspaces, apps, dashboards, interactive Energy BI studies and paginated studies within the Energy BI service.
I envision that my production-scale logging answer will use an orchestration software like Azure Information Manufacturing unit to iterate over historic exercise logs, retailer log information to Azure Information Lake Storage after which incrementally replace a Energy BI information mannequin for reporting and evaluation. This primary instance will use PowerShell script manually executed from my desktop.
PowerShell Me, Child
The brand new Get-PowerBIActivityEvent commandlet is added to the Microsoft Energy BI Administration library. Set up the most recent model to achieve entry to the exercise logs.
In my mission, step one is to open and run the PowerShell ISE as an area administrator. To put in the most recent Energy BI Administration library domestically, I execute this code :
Set up-Module -Title MicrosoftPowerBIMgmt.Admin
I have to sign-in to my Energy BI tenant with a service or person account that has tenant admin privileges. This code opens an ordinary login dialog and prompts for a person title and password, populating a Credential kind object variable used to open a connection to the Energy BI service:
$Cred = Get-Credential
Join-PowerBIServiceAccount -Credential $Cred
Within the Energy BI product crew’s Developer weblog, Senior Program Supervisor Kay Unkroth explains that the Get-PowerBIActivityEvent commandlet could be known as with date/time parameters to incorporate solely sooner or later at a time. This line requests all exercise on Junuary fifth, 2020, caching the exercise log data as a JSON construction:
$actions = Get-PowerBIActivityEvent -StartDateTime ‘2020-01-05T00:00:00.000’ -EndDateTime ‘2020-01-05T23:59:59.999’
Lastly, I write the log contents to an area file utilizing this code:
$actions | Out-File -FilePath C:TempRSActivityLog.json
Importing this file into Energy BI Desktop produces the next easy desk:
A few necessary issues to level out
The API is optimized to deal with giant numbers of occasions. As such, it’s restricted to return data for a variety of time as much as one full day utilizing the StartDateTime and EndDateTime parameters. The net service returns a continuation token return parameter to let you already know if there may be extra information past a hard and fast body dimension that can usually return about 5,000 to 10,000 data.
By the way, I’ve performed with a number of totally different file codecs. JSON is by far probably the most versatile format however you could not get all the important thing/values you need simply by consuming the outcomes proper out-of-the-box and with out parsing all of the nested ranges. In Kay’s article, he makes use of the ConvertTo-JSON directive to flatten the native JSON doc right into a extra standard colon-delineated log flat file with named key/worth pairs. Utilizing this methodology, I used to be in a position to get extra area data that people who apparently slipped via the cracks from the JSON doc. Though, I needed to therapeutic massage the output a bit after which rework the rows into columns utilizing some fancy pivot dancing in Energy Question.
This straightforward report
is a primary effort displaying data for a short while body. I’ve produced a single desk with some recognizable grouping and slicing attributes however we are able to do significantly extra. Utilizing these fields, I analyze actions for less than dashboard , Energy BI or paginated report views. We will filter by person, object kind, operation kind, the net browser or gadgets used to view content material, kind of workload or the containing workspace.
In a fully-fleshed-out information mannequin, a number of the attributes would possibly exist as separate dimension/lookup tables. However, that is sufficient for now.
Put up Conclusion
Please share your questions and your individual expertise with the exercise logging API, and look ahead to subsequent posts about tenant monitoring and exercise administration options.