Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi All,
As an Admin how do I know who has access to which workspaces and also which reports ?
Also, how do I see all the workspaces and delete if not required and also the respected owners list and also the reports they published to these workspaces and also how to remove them in the future if they leave the organization and report is no longer needed.
Solved! Go to Solution.
Hi @viswaaa ,
you can refer the below document related to Power BI REST API :
https://learn.microsoft.com/en-us/rest/api/power-bi/
Hi All,
I can see all the workspaces and I need to see what reports are uploaded in those work spaces and how I can delete them if needed.
Pease suggest
Hi @viswaaa ,
You can prefer the below screenshot :
Reference : Delete a dashboard, report, workbook, semantic model, or workspace - Power BI | Microsoft Learn
If this post was helpful, please consider marking Accept as solution to assist other members in finding it more easily.
If you continue to face issues, feel free to reach out to us for further assistance!
Regards
aatheeque
Hi @viswaaa ,
we wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.
If our response has addressed your query, please accept it as a solution so that other community members can find it easily.
Hi ,
Could you please let mw know how I can do below things using rest API
Like where I need to run and the code
Hi @viswaaa ,
you can refer the below document related to Power BI REST API :
https://learn.microsoft.com/en-us/rest/api/power-bi/
Hi @viswaaa ,
If our response addressed by the community member for your query, please mark it as Accept Answer and click Yes if you found it helpful.
Should you have any further questions, feel free to reach out.
Thank you for being a part of the Microsoft Fabric Community Forum!
Hi @viswaaa ,
we wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.
If our response has addressed your query, please accept it as a solution so that other community members can find it easily.
Assuming you have everything else set up (service principle, permissions etc.).
PowerShell to get all workspaces:
Install-Module -Name MicrosoftPowerBIMgmt
Connect-PowerBIServiceAccount
Get-PowerBIWorkspace -Scope Organization -All -Include All| ConvertTo-Json -Depth 10 | Out-file C:\Workspaceuser.txt
Python to get all workspaces:
#########################################################################################
# Authentication - Replace string variables with your relevant values
#########################################################################################
import json, requests, pandas as pd
try:
from azure.identity import ClientSecretCredential
except Exception:
!pip install azure.identity
from azure.identity import ClientSecretCredential
# --------------------------------------------------------------------------------------#
# String variables: Replace with your own
tenant = 'Your-Tenant-ID'
client = 'Your-App-Client-ID'
client_secret = 'Your-Client-Secret-Value' # See Note 2: Better to use key vault
api = 'https://analysis.windows.net/powerbi/api/.default'
# --------------------------------------------------------------------------------------#
# Generates the access token for the Service Principal
auth = ClientSecretCredential(authority = 'https://login.microsoftonline.com/',
tenant_id = tenant,
client_id = client,
client_secret = client_secret)
access_token = auth.get_token(api)
access_token = access_token.token
print('
Successfully authenticated.')
#########################################################################################
# Note 1: This code was authored for use in a Google Colab Notebook
# Note 2: Check here for info on using Azure Key Vault:
# https://docs.microsoft.com/en-us/azure/key-vault/secrets/quick-create-python
# The above code should be modified to programmatically get the secret from AKV
#########################################################################################
# Admin: Get all Workspaces only - see Gist for all workspaces + expand
#########################################################################################
base_url = 'https://api.powerbi.com/v1.0/myorg/'
header = {'Authorization': f'Bearer {access_token}'}
# The admin API doesn't work unless you provide a ?$top=n argument
# Top 5000 workspaces
topn = '$top=5000'
# Get workspaces only
admin_groups = f'{base_url}admin/groups?{topn}'
# HTTP GET Request
groups = requests.get(admin_groups, headers=header)
# Response code (200 = Success; 401 = Unauthorized; 404 = Bad Request)
print(groups)
try:
groups = json.loads(groups.content)
except Exception as e:
print(e)
exit()
#########################################################################################
# Return the results in dataframes
#########################################################################################
try:
result = pd.concat([pd.json_normalize(x) for x in groups['value']])
print('Found', len(result['id'].dropna().unique().tolist()), 'workspaces.')
except Exception:
print('No workspaces found.')
Hi @viswaaa ,
Thanks for reaching out to the Microsoft Fabric Community forum.
@andrewsommer @lbendlin Thanks for your prompt response. In addition to that let me add some more insights :
To list all workspaces, users, and their roles:
If our response addressed by the community member for your query, please mark it as Accept Answer and click Yes if you found it helpful.
Should you have any further questions, feel free to reach out.
Thank you for being a part of the Microsoft Fabric Community Forum!
There are a variety of ways to go about this but the best is using the Power BI REST API to pull whatever you want. You can get your workspaces and reports plus a whole lot more.
https://docs.microsoft.com/en-us/rest/api/power-bi/
Workspaces in Power BI - Power BI | Microsoft Learn
Also read about the Tenant Audit Reports and about Purview (if applicable)