A common ask I get from customers is, "How can I report on a user's sign-ins to Power Apps in the past x days?" What many tend to overlook is that sign in logs are already stored in Azure Active Directory. To report on them, we can connect to a Log Analytics workspace and pull that into Power BI.

Capturing the sign ins with Log Analytics

1. Create a Log Analytics workspace in the Azure portal.

2. From Azure Active Directory, in the left-navigation pane navigate to Monitoring Diagnostic settings > Click + Add diagnostic setting.

Under Categories, select SignInLogs. Under Destination details, select Send to Log Analytics workspace. Choose the workspace you just created and Save.

Now wait-- give it some time for the sign in logs to be captured in the Log Analytics workspace.

3. Navigate to the Log Analytics workspace that you just created. On the left, under General, navigate to Logs. A modal pane will pop-up with some suggested queries-- feel free to browse this. These queries are written in KQL.. if you are unfamiliar with the syntax, check out the reference guide at Microsoft docs. For our purposes though, you can go ahead and close the pane to get to the workspace.

The query I used here is below.  Paste the query into the workspace and click Run.  

| where AppDisplayName == "Power Platform Admin Center" or AppDisplayName contains "powerapps"

4. Once you have browsed the results (don't forget to scroll to the right!) and are sure that this is what you want in your report, click on Export > Export to Power BI (M query). This will download a .txt file with the query we will use in Power BI.

Pulling the sign ins into Power BI

5. Open Power BI Desktop and create a new report. From the blank report, click on Get dataBlank query. 

From Power Query Editor, click on Advanced Editor.

Clear out the default text in the Advanced Editor and paste the query from the .txt file that you downloaded from Log Analytics. Click Done.

6. You'll now be able to see the results of the query in Power Query Editor.

Transform the data as needed. For tips on data transformation, check out this learning path on Microsoft Docs. Once you've done so, click Close and Apply.

7. From here, you're ready to pull in the needed columns into the visualizations of your choice! For tips on visualizing data in Power BI, there's this learning path on Microsoft Docs.

Skylar Shonblom