Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hello,
I am looking to write a PowerShell script that will retrieve all available information pertaining to Audiences in Power BI, including which reports are published to which audience, and which users or groups have viewing permissions to each audience.
When I asked Bing AI on Sunday, it happily returned this script:
# Load the Power BI module
Import-Module MicrosoftPowerBIMgmt
# Login to Power BI service
Login-PowerBI
# Get the workspace ID by name
$workspace = Get-PowerBIWorkspace -Name "My Workspace"
# Get the app ID by workspace ID
$app = Get-PowerBIApp -WorkspaceId $workspace.Id
# Get the audiences for the app
$audiences = Get-PowerBIAppAudience -AppId $app.Id
# Loop through each audience and get all available information for it
foreach ($audience in $audiences) {
Write-Host "Audience: $($audience.Name)"
Write-Host "ID: $($audience.Id)"
Write-Host "Description: $($audience.Description)"
Write-Host "Created By: $($audience.CreatedBy)"
Write-Host "Created On: $($audience.CreatedOn)"
Write-Host "Modified By: $($audience.ModifiedBy)"
Write-Host "Modified On: $($audience.ModifiedOn)"
Write-Host "Users or groups:"
$users = Get-PowerBIAppAudienceUser -AppId $app.Id -AudienceId $audience.Id
foreach ($user in $users) {
Write-Host "$($user.DisplayName) ($($user.EmailAddress))"
}
}
Two days later, this seems to have disappeared from Bing. The command Get-PowerBIAppAudience doesn't seem to exist anywhere on the Internet. Bing now recommends an imaginary URL about a non-existent Operation on the REST API page.
We have hundreds of workspaces in our tenant, each with or without an audience for its published reports. Retrieving this information manually is not a feasible solution.
Does there exist a cmdlet or script that will return the desired information?
No, still not possible. And believe it or not but there is also no systemic link between App ID and workspace ID in any of the APIs.
Does anyone have the answer to this question? The Scanner API doesn't include the Users of PBI App Audience. As I see, there is nowhere that we can extract that information automatically.
@darwindat you are unfortunately correct. I checked the Scanner API (as I should have done before posting) and there's no coverage of audience membership. Apologies.
If this is important to you please consider voting for an existing idea or raising a new one at https://ideas.fabric.microsoft.com/?forum=2d80fd4a-16cb-4189-896b-e0dac5e08b41
<sad tuba>womp womp</sad tuba>
Thank you for looking into this. I appreciate your time even if the answer doesn't solve my problem.
Check the Scanner API. It should cover that part of the meta data.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
39 | |
26 | |
21 | |
19 | |
10 |
User | Count |
---|---|
38 | |
36 | |
34 | |
20 | |
14 |