Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Unable to list access list in powerbi workspace using powershell

hi Team,

I want to extract the report of Access list of Powerbi workspaces like who has Member\Admin\Contributor\Viewer.

Im unable to find the command for that. i pre-assume command should be something like "get-PowerBIWorkspaceUser" but its returning :

"get-PowerBIWorkspaceUser: The term 'get-PowerBIWorkspaceUser' is not recognized as the name of a cmdlet, function, script file, or operable program."

also the command " Get-PowerBIWorkspace -Scope -User "abc" is not working for me.

 

The below command also returned error :

Get-PowerBIWorkspace -Scope Organization -User "abc"

 

Get-PowerBIWorkspace: Operation returned an invalid status code 'Unauthorized'

 

Please help.

7 REPLIES 7
lbendlin
Super User
Super User

Unless you are the tenant admin there is nothing at the moment you can do except for screen scraping, and voting for the idea.

 

If you are the tenant admin then use the "Workspacesusers"  audit log for v2 workspaces.

 

For v1 workspaces you are on your own, I can show you a Powershell script that iterates through AD if you like.

Anonymous
Not applicable

For v1 workspaces you are on your own, I can show you a Powershell script that iterates through AD if you like. - can you please share the solution for this ?

 

and also please help clarify :

 

1.)  how do i check if im the teanant id , i usualy login with service account from which i have setup the entire BI architecture.

2.) how to check which version of workspaces im using , is it v1 or v2 ?

 

 

Here's the script

Connect-AzureAD
#export workspace ID list from Power BI audit file to v1workspaces.csv
Set-Location -Path C:\Users\xxx\Downloads
write-output "ID,email,role"
Import-Csv "v1workspaces.csv" | ForEach-Object { 
    $ws = $_.name
    $wi = $_.id
    try {
        ForEach ($o in (Get-AzureADGroupOwner -ALL 1 -ObjectId "$wi" -ErrorAction SilentlyContinue)) {
            write-output "$($wi),$($o.UserPrincipalName),Owner"
        }
        ForEach ($o in (Get-AzureADGroupMember -ALL 1 -ObjectId "$wi" -ErrorAction SilentlyContinue)) {
            write-output "$($wi),$($o.UserPrincipalName),Member"
        }
    } 
    catch {
        write-output "$($wi),Workspace not found,none"
    }
    # $ws
}

 

#1 - if you have to ask then you probably aren't 🙂

 

#2 - v1 workspaces have owners and members. v2 workspaces have admins, contributors, members and readers

Anonymous
Not applicable

Hello,

 

Thanks for sharing the script , however im able to retreive the workspace id's and and their name with commandlet :

Get-PowerBIWorkspace

 

The requirement again circles back to my original post. im looking " how to retreive the Acces list for each workspace using a single command or any script".

 

Example : i have 1 workspace abc , now business wants the list of users having access to workspaces, reports , datasets etc.

                 like who all have admin, viewer, contributor privalges etc given any workspace.

 

Today we have command available for  Add-PowerBIWorkspaceUser , Remove-PowerBIGroupUser similary looking for commandlet with retreiving \get the list of powerbi workspace users with their access level.

 

Please let me know if we can get that list by anyhow?

 

Please Note : We are not having the admin portal access  as we do not have the PowerBI premium License and are operating with the pro license.

There is no single script to achieve what you want to do.

Anonymous
Not applicable

A working script with the required data will do. agreed currently its not possible with single command.

 

but ideally in powershell world ,

 

if we have verbs such as add , remove , update  for a service/command  we definately should have get command which currently is missing for the "MicrosoftPowerBIMgmt.Workspaces".

 

I need a solution aroud this, be it anything with REST API will also do.

You can invoke REST API calls in Powershell without ever needing to install the Power BI specific libraries.

 

Like so

 

 

$uri ="https://api.powerbi.com/v1.0/myorg/groups/$groupsPath/reports/$reportID/pages"
$Pages = Invoke-RestMethod -Uri $uri –Headers $authHeader –Method GET

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors