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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
sreedhary
Helper I
Helper I

Power BI Report for list of Pending access requests for reports and apps

Hi,

 

we are trying extract the list of pending access requests for Power BI reports and Apps using the Rest API, but we are not able extract it. Snippet of the code is as follows. We are getting blank excel after executing this code.

any help is appreciated. Please suggest if any other method to get the list of Pending request for reports and Apps.

 

# Connect to Power BI service (make sure you run this first)
Connect-PowerBIServiceAccount

# Get all workspaces
$workspaces = Get-PowerBIWorkspace

# Loop through each workspace
foreach ($workspace in $workspaces) {
Write-Host "Workspace: $($workspace.Name)"

# Get all reports in the workspace
$reports = Get-PowerBIReport -WorkspaceId $workspace.Id

# Loop through each report
foreach ($report in $reports) {
Write-Host " Report: $($report.Name)"

# Get manage permissions information
$url = "https://api.powerbi.com/v1.0/myorg/admin/reports/$($report.Id)/users"
$permissions = Invoke-PowerBIRestMethod -Url $url -Method Get | ConvertFrom-Json

# Display pending users
$pendingUsers = $permissions.value | Where-Object { $_.principalType -eq "User" -and $_.userState -eq "Pending" }

if ($pendingUsers) {
Write-Host " Pending Users:"
foreach ($user in $pendingUsers) {
Write-Host " - $($user.emailAddress) (Access: $($user.accessRight))"
}
} else {
Write-Host " No pending users for this report."
}

Write-Host ""
}

Write-Host ""
}

# Disconnect from Power BI service
Disconnect-PowerBIServiceAccount

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks for the reply from lbendlin  please allow me to provide another insight:

Hi, @sreedhary .

Your idea is excellent and certainly a good approach to automation. However, I share Benzerlin's view that if you wish to use the API you provided to obtain a list of individuals requesting access, this is currently not supported. Here are my findings from testing:

 

1.Firstly, aside from the administrators, there is one individual who has applied for access to the report.

vlinyulumsft_4-1729055153637.png

2.Secondly, I conducted tests using the API you provided,here are the final results:

vlinyulumsft_5-1729055228914.png

The evidence clearly shows that it is indeed not possible to retrieve the list of individuals currently applying for access.

 

I recommend that you temporarily handle the applicant information through manual queries.

vlinyulumsft_2-1729054962709.png

https://learn.microsoft.com/en-us/power-bi/collaborate-share/service-share-dashboards#manage-permiss...

Of course, you might also consider accepting lbendlin's response as a solution, as this would allow other members with similar thoughts to find the post more quickly and vote on your idea.


If you have any new ideas, you are welcome to contact us.
 

Best Regards,

Leroy Lu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Thanks for the reply from lbendlin  please allow me to provide another insight:

Hi, @sreedhary .

Your idea is excellent and certainly a good approach to automation. However, I share Benzerlin's view that if you wish to use the API you provided to obtain a list of individuals requesting access, this is currently not supported. Here are my findings from testing:

 

1.Firstly, aside from the administrators, there is one individual who has applied for access to the report.

vlinyulumsft_4-1729055153637.png

2.Secondly, I conducted tests using the API you provided,here are the final results:

vlinyulumsft_5-1729055228914.png

The evidence clearly shows that it is indeed not possible to retrieve the list of individuals currently applying for access.

 

I recommend that you temporarily handle the applicant information through manual queries.

vlinyulumsft_2-1729054962709.png

https://learn.microsoft.com/en-us/power-bi/collaborate-share/service-share-dashboards#manage-permiss...

Of course, you might also consider accepting lbendlin's response as a solution, as this would allow other members with similar thoughts to find the post more quickly and vote on your idea.


If you have any new ideas, you are welcome to contact us.
 

Best Regards,

Leroy Lu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

lbendlin
Super User
Super User

There is no "userState"  attribute for that call.

 

Admin - Reports GetReportUsersAsAdmin - REST API (Power BI Power BI REST APIs) | Microsoft Learn

 

If this is important to you please consider voting for an existing idea or raising a new one at https://ideas.fabric.microsoft.com

Is there anyway to see users that have requested access at all?  Would they have a userType of NONE or something like that?

Anyway to do a mismatch check?

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors