Power BI (Fabric) Tenant Settings Reporter
Power BI has by far the largest number of settings and controls across the entire Microsoft 365 platform (including Power Platform itself).
The Challenge
Working with clients over the years, I found it time-consuming to capture these each time as part of health checks, migration preparations, and various other projects.
Unfortunately, while great tools might include Power Platform settings (e.g. Microsoft 365 DSC) — they often leave out Power BI. That might be because they don’t consider Power BI part of Power Platform, but I’m not going to get into that fight over branding/marketing/bundling vs. facts. :-)
Speaking with a colleague and fellow MVP as well as searching online, I found a couple of solutions for quickly capturing the settings as well as representing them. I combined these, made some tweaks, and turned it into a repeatable solution that anyone can use.
The Solution
To extract the data we need to run a PowerShell script with an administrative account that accesses the Fabric admin API and scrapes all the settings into a JSON format file.
While this can be captured in a readable format, we want something a bit nicer to look at as well as the ability to sort, filter, and search.
The Script
Running the script will extract all the settings from the Power BI (Fabric) tenant and save them to a JSON file, which will later be used by the report template.
Some key requirements for the account running the script:
- Have either the Fabric Administrator or Power Platform Administrator roles assigned
- Have what is called the “Microsoft Fabric free” (formerly “Power BI free”) license assigned at a minimum
To run the script, make sure you have navigated to the location where you would like the file to be stored.
Upon running the script it will check to see if you have the Az.Accounts PowerShell module already installed, and if not — it will install it for you in the current user scope (avoiding any issues with local administrator restrictions).
Once the module is installed, it will then prompt you for the tenant ID you wish to run this against, as well as the file name you want to save the outputs to.
You can see the script below, or download it ready-to-run from my GitHub repository.
# Welcome text
Write-Output "Welcome! This script will capture all the Power BI settings in a Microsoft 365 tenant."
Write-Output ""
Write-Output "Before continuing, make sure that you have a Power BI or Fabric assigned to your account, and that you have either the Power Platform Administrator or Fabric Administrator admin roles.."
Write-Output ""
Write-Output ""
Write-Output "The first thing this script will do is check if you have the Az.Accounts PowerShell module installed as we need this to authenticate against the Microsoft Fabric admin API."
Write-Output "If the module is not installed, it will be installed for the current user only."
# Check if the Az.Accounts module is installed
if (-not (Get-Module -ListAvailable -Name Az.Accounts)) {
Write-Output "Az.Accounts module not found. Installing..."
Install-Module -Name Az.Accounts -Scope CurrentUser -Force
} else {
Write-Output "Az.Accounts module is already installed. We can continue."
}
# Import the Az.Accounts module
Import-Module Az.Accounts
Write-Output "Now we need to know the tenant ID you want to run this scanner against."
Write-Output "You can find that in the Entra admin center, or by visiting https://www.whatismytenantid.com"
# Prompt the user to input the TENANTID value
$tenantId = Read-Host -Prompt "Enter the tenant ID"
Write-Output "What name do you want to use for file with the outputs?"
Write-Output "(Make sure there are no spaces in the name, and DO NOT include the file extension.)"
# Prompt the user to input the FILENAME value
$filename = Read-Host -Prompt "Enter the file name"
# Define required variables
$resourceUrl = 'https://api.fabric.microsoft.com'
$requestUrl = 'https://api.fabric.microsoft.com/v1/admin/tenantsettings'
$contentType = "application/json; charset=utf-8"
# Connect to Azure account
Connect-AzAccount -DeviceCode -TenantId $tenantId
# Get the access token
$accessToken = (Get-AzAccessToken -ResourceUrl $resourceUrl).Token
# Set the headers for the request
$headers = @{
'Content-Type' = $contentType
'Authorization' = "Bearer $($accessToken)"
}
# Make the request and save the response to a file
((Invoke-WebRequest -Headers $headers -Method "Get" -Uri $requestUrl -TimeoutSec 240).Content) > "$filename.json"
Write-Output "Request completed. Response saved to $filename.json"
Running the script should only take a few seconds to capture all the data and save it to the location specified, using the name you provided.
The Report
Displaying the outputs in the Power BI report is relatively straight forward.
Simply download the template file from my GitHub repository, and double-click to open it.
From there you will be prompted for the path to the JSON file generated by the PowerShell script:
Press the Load button, and presto!
Conclusion & Next Steps
This report could be expanded add one or more input files in order to show the differential between tenants, tracking configuration changes over a period of time, or anything else.
Enjoy!
Credits / Thanks
This solution was the culmination of suggestions and inputs from my colleague and fellow MVP Heidi Hasting, the original PowerShell script, and the inspiration for the Power BI report.
Originally published at Loryan Strant, Microsoft 365 MVP.