![]()
Power BI auditing allows organizations to track user activities, such as report views, dataset modifications, sharing actions, and dashboard access. Enabling audit logs ensures compliance, security, and governance.
This guide provides step-by-step instructions to enable Power BI auditing using PowerShell.
Step 1: Prerequisites
1. Install the Required PowerShell Module
Ensure the Microsoft Power BI Management module is installed. If not, install it using:
Install-Module MicrosoftPowerBIMgmt -Scope CurrentUser -Force
Power BI PowerShell module installed!
2. Connect to Power BI
Authenticate with your Power BI admin account:
Connect-PowerBIServiceAccount
Authenticated successfully!
3. Verify Microsoft Purview (Compliance Center) Access
To enable audit logging, ensure:
- You have Global Admin, Compliance Admin, or Audit Reader roles in Microsoft 365.
- Auditing is enabled in Microsoft Purview (Compliance Center).
To check if auditing is enabled:
Get-AdminAuditLogConfig | Format-List UnifiedAuditLogIngestionEnabled
If the output is False, enable it in the Microsoft 365 Compliance Center.
Step 2: Enable Power BI Auditing
1. Enable Unified Audit Log in Microsoft 365
Run the following command to enable organization-wide auditing:
Set-AdminAuditLogConfig -UnifiedAuditLogIngestionEnabled $true
Unified audit log enabled!
2. Enable Power BI Activity Logging
To enable auditing specifically for Power BI:
Set-PowerBIServiceSetting -AllowServicePrincipalAuditLogAccess $true
Power BI auditing enabled!
Step 3: Verify Audit Log Configuration
To confirm that Power BI auditing is active, run:
Get-PowerBIServiceSetting | Select-Object AllowServicePrincipalAuditLogAccess
Audit logging verified!
Step 4: Retrieve Power BI Audit Logs
To fetch audit logs for Power BI activities, use:
Search-UnifiedAuditLog -StartDate (Get-Date).AddDays(-7) -EndDate (Get-Date) -RecordType PowerBI
Audit logs retrieved!
Step 5: Export Power BI Audit Logs
To export audit logs to a CSV file:
$logs = Search-UnifiedAuditLog -StartDate (Get-Date).AddDays(-7) -EndDate (Get-Date) -RecordType PowerBI
$logs | Export-Csv -Path "C:\AuditLogs\PowerBIAuditLogs.csv" -NoTypeInformation
Audit logs exported to CSV!
Step 6: Monitor Power BI Audit Logs Automatically
To automate Power BI audit logging, create a PowerShell script PowerBI_Audit.ps1:
# Connect to Power BI and Microsoft 365
Connect-PowerBIServiceAccount
Connect-ExchangeOnline -UserPrincipalName "admin@yourdomain.com"
# Retrieve Power BI audit logs
$logs = Search-UnifiedAuditLog -StartDate (Get-Date).AddDays(-1) -EndDate (Get-Date) -RecordType PowerBI
# Save logs
$logs | Export-Csv -Path "C:\AuditLogs\PowerBIAuditLogs_$(Get-Date -Format 'yyyyMMdd').csv" -NoTypeInformation
Write-Host " Power BI audit logs saved!"
Power BI audit logs automated!
