How ruiromano/pbimonitor works
Project type and purpose
• This is a monitoring/ETL solution for Power BI tenants. It uses PowerShell scripts orchestrated by Azure Functions (timer triggers) to collect data from Power BI Admin APIs, Microsoft Graph API, and Fabric/Tenant APIs, storing the raw output in Azure Blob Storage. The data is then consumed by Power BI Desktop templates for analysis.
Main components
a. Azure Active Directory
• Service Principal (App Registration)
• Security Group (holds Service Principal)
b. Azure Function App
• Five timer‐triggered functions:
• AuditsTimer
• CatalogTimer
• DatasetRefreshTimer
• GraphTimer
• TenantSettingsTimer
• Shared Scripts folder and Modules (utils.psm1, Scripts/*.ps1)
• Configuration via Application Settings (ServicePrincipalId, Secret, TenantId, Storage settings, etc.)
• Optional Key Vault references for secrets
• App Insights for logging/monitoring
c. Azure Storage Account (Blob Storage)
• Container “pbimonitor”
• Raw JSON blobs organized by function and date
d. Power BI Desktop Templates (.pbit)
• Templates for Blob Storage and local file scenarios
• Incremental refresh parameters
e. Local PowerShell alternative
• Fetch-Run.ps1 entrypoint
• Config.json
Interactions and data flow
1. Timer triggers fire in Azure Function App
2. Function code loads PS scripts from its Scripts folder or zip deployment
3. Scripts authenticate using Service Principal against AAD
4. Scripts call:
• Power BI Admin APIs (Activity, Scan, RefreshHistory)
• Microsoft Graph API (Users, Licenses)
• Fabric Tenant Settings API
5. Results written as JSON to Blob Storage under “raw” path
6. State file (state.json) in function AppData tracks last run timestamps
7. Power BI Desktop template connects to Blob Storage, applies transformations, builds reports
Architectural patterns & principles
• Serverless timer-based ETL (Azure Functions)
• Infrastructure-as-code compatible (zip deploy, PS modules)
• State management via file on function disk (state.json)
• Secure credentials via App Settings or Key Vault references
• Separation of concerns: one timer per data domain
• Idempotent blob outputs enable incremental processing