Forum Discussion
Phasing out the report
- 6 months ago
Hi stribor45 ,
Yes, we can put a banner in the report as a notification stating that this report will be retired and provide the link to the new report.
To get the list of users, we can directly hit the REST API to retrieve users from the semantic model's manage permissions, as this is managed at the semantic model level, not the report level.import msal import requests import csv # Creds CLIENT_ID ='abc' CLIENT_SECRET = 'abc' TENANT_ID = 'abc' WORKSPACE_ID ='abc' DATASET_ID = 'abc'' AUTHORITY_URL = f"https://login.microsoftonline.com/{TENANT_ID}" SCOPE = ["https://analysis.windows.net/powerbi/api/.default"] # Bearer token def get_access_token(): app = msal.ConfidentialClientApplication( CLIENT_ID, authority=AUTHORITY_URL, client_credential=CLIENT_SECRET ) result = app.acquire_token_for_client(scopes=SCOPE) if "access_token" in result: return result["access_token"] else: raise Exception(f"Token Error: {result.get('error_description')}") # Get users def get_dataset_users(access_token): url = f"https://api.powerbi.com/v1.0/myorg/groups/{WORKSPACE_ID}/datasets/{DATASET_ID}/users" headers = { "Authorization": f"Bearer {access_token}" } users = [] while url: response = requests.get(url, headers=headers, timeout=30) if response.status_code != 200: raise Exception(f"API Error {response.status_code}: {response.text}") data = response.json() users.extend(data.get("value", [])) # Handle pagination url = data.get("@odata.nextLink") return users # check access try: print("Authenticating...") token = get_access_token() print("Fetching semantic model users...") users = get_dataset_users(token) print("\n--- Users with Direct Access to Semantic Model ---\n") for user in users: print( f"Identifier: {user.get('identifier')} | " f"Principal Type: {user.get('principalType')} | " f"Access Right: {user.get('datasetUserAccessRight')}" ) except Exception as e: print(f"Error: {e}")
Thanks
If this response was helpful in any way, I’d gladly accept a kudo.
Please mark it as the correct solution. It helps other community members find their way faster
Hi , you need to create a service principal for Power bi
https://support.optisigns.com/hc/en-us/articles/32860569148819-How-to-Set-Up-a-PowerBI-Service-Principal-for-Use-in-OptiSigns
you can follow the steps from the abv link
Thanks .
If this response was helpful in any way, I’d gladly accept a kudo.
Please mark it as the correct solution. It helps other community members find their way faster