SLL v0.9.6
Running list_workspace_users() with my own user ID is working ok
Running the same function with a Service Principle is producing an error

FabricHTTPException Traceback (most recent call last)
File /nfs4/pyenv-955aa317-b5c9-45b5-81f0-27dfd2e0f3a1/lib/python3.11/site-packages/sempy_labs/_helper_functions.py:847, in resolve_workspace_name(workspace_id)
846 try:
--> 847 response = _base_api(
848 request=f"/v1/workspaces/{workspace_id}", client="fabric_sp"
849 ).json()
850 except FabricHTTPException:
File /nfs4/pyenv-955aa317-b5c9-45b5-81f0-27dfd2e0f3a1/lib/python3.11/site-packages/sempy_labs/_helper_functions.py:1758, in _base_api(request, client, method, payload, status_codes, uses_pagination, lro_return_json, lro_return_status_code)
1757 if method == "get":
-> 1758 response = c.get(request)
1759 elif method == "delete":
File /nfs4/pyenv-955aa317-b5c9-45b5-81f0-27dfd2e0f3a1/lib/python3.11/site-packages/sempy/fabric/_client/_rest_client.py:155, in BaseRestClient.get(self, path_or_url, *args, **kwargs)
137 """
138 GET request to the Fabric and PowerBI REST API.
139
(...)
153 The response from the REST API.
154 """
--> 155 return self.request("GET", path_or_url, *args, **kwargs)
File /nfs4/pyenv-955aa317-b5c9-45b5-81f0-27dfd2e0f3a1/lib/python3.11/site-packages/sempy/fabric/_client/_rest_client.py:323, in FabricRestClient.request(self, method, path_or_url, lro_wait, lro_max_attempts, lro_operation_name, *args, **kwargs)
298 """
299 Request to the Fabric REST API.
300
(...)
321 The response from the REST API.
322 """
--> 323 response = super().request(method, path_or_url, *args, **kwargs)
325 if not lro_wait or response.status_code != 202:
File /nfs4/pyenv-955aa317-b5c9-45b5-81f0-27dfd2e0f3a1/lib/python3.11/site-packages/sempy/fabric/_client/_rest_client.py:134, in BaseRestClient.request(self, method, path_or_url, *args, **kwargs)
132 kwargs["headers"] = headers
--> 134 return self.http.request(method, *args, **kwargs)
File ~/cluster-env/trident_env/lib/python3.11/site-packages/requests/sessions.py:589, in Session.request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
588 send_kwargs.update(settings)
--> 589 resp = self.send(prep, **send_kwargs)
591 return resp
File ~/cluster-env/trident_env/lib/python3.11/site-packages/requests/sessions.py:710, in Session.send(self, request, **kwargs)
709 # Response manipulation hooks
--> 710 r = dispatch_hook("response", hooks, r, **kwargs)
712 # Persist cookies
File ~/cluster-env/trident_env/lib/python3.11/site-packages/requests/hooks.py:30, in dispatch_hook(key, hooks, hook_data, **kwargs)
29 for hook in hooks:
---> 30 _hook_data = hook(hook_data, **kwargs)
31 if _hook_data is not None:
File /nfs4/pyenv-955aa317-b5c9-45b5-81f0-27dfd2e0f3a1/lib/python3.11/site-packages/sempy/_utils/_log.py:357, in mds_log..get_wrapper..log_decorator_wrapper(*args, **kwargs)
356 try:
--> 357 result = func(*args, **kwargs)
359 # The invocation for get_message_dict moves after the function
360 # so it can access the state after the method call
File /nfs4/pyenv-955aa317-b5c9-45b5-81f0-27dfd2e0f3a1/lib/python3.11/site-packages/sempy/fabric/_client/_rest_client.py:73, in BaseRestClient.init..validate_rest_response(response, *args, **kwargs)
72 if response.status_code >= 400:
---> 73 raise FabricHTTPException(response)
FabricHTTPException: 403 Forbidden for url: https://api.fabric.microsoft.com//v1/workspaces/ebc76500-
Error: {"requestId":"312f9aca-3959-4653-ad3a-c4f4495b7098","errorCode":"InsufficientPrivileges","message":"The caller does not have sufficient permissions to access the requested resource","relatedResource":{"resourceId":"ebc76500-","resourceType":"Workspace"}}
Headers: {'Cache-Control': 'no-store, must-revalidate, no-cache', 'Pragma': 'no-cache', 'Transfer-Encoding': 'chunked', 'Content-Type': 'application/json; charset=utf-8', 'x-ms-public-api-error-code': 'InsufficientPrivileges', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains', 'X-Frame-Options': 'deny', 'X-Content-Type-Options': 'nosniff', 'RequestId': '312f9aca-3959-4653-ad3a-c4f4495b7098', 'Access-Control-Expose-Headers': 'RequestId', 'Date': 'Thu, 13 Mar 2025 08:14:04 GMT'}
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
Cell In[28], line 7
1 with labs.service_principal_authentication(
2 key_vault_uri=key_vault_uri,
3 key_vault_tenant_id=key_vault_tenant_id,
4 key_vault_client_id=key_vault_client_id,
5 key_vault_client_secret=key_vault_client_secret):
----> 7 df = labs.list_workspace_users()
8 display(df)
File /nfs4/pyenv-955aa317-b5c9-45b5-81f0-27dfd2e0f3a1/lib/python3.11/site-packages/sempy_labs/_workspaces.py:126, in list_workspace_users(workspace)
105 def list_workspace_users(workspace: Optional[str | UUID] = None) -> pd.DataFrame:
106 """
107 A list of all the users of a workspace and their roles.
108
(...)
123 A pandas dataframe the users of a workspace and their properties.
124 """
--> 126 (workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
128 columns = {
129 "User Name": "string",
130 "Email Address": "string",
(...)
133 "User ID": "string",
134 }
135 df = _create_dataframe(columns=columns)
File /nfs4/pyenv-955aa317-b5c9-45b5-81f0-27dfd2e0f3a1/lib/python3.11/site-packages/sempy_labs/_helper_functions.py:879, in resolve_workspace_name_and_id(workspace)
877 if workspace is None:
878 workspace_id = _get_fabric_context_setting(name="trident.workspace.id")
--> 879 workspace_name = resolve_workspace_name(workspace_id)
880 elif _is_valid_uuid(workspace):
881 workspace_id = workspace
File /nfs4/pyenv-955aa317-b5c9-45b5-81f0-27dfd2e0f3a1/lib/python3.11/site-packages/sempy_labs/_helper_functions.py:851, in resolve_workspace_name(workspace_id)
847 response = _base_api(
848 request=f"/v1/workspaces/{workspace_id}", client="fabric_sp"
849 ).json()
850 except FabricHTTPException:
--> 851 raise ValueError(
852 f"{icons.red_dot} The '{workspace_id}' workspace was not found."
853 )
855 return response.get("displayName")
ValueError: 🔴 The 'ebc76500-' workspace was not found.
Running the same command from the admin package is producing the same error

SLL v0.9.6
Running list_workspace_users() with my own user ID is working ok
Running the same function with a Service Principle is producing an error
FabricHTTPException Traceback (most recent call last)
File /nfs4/pyenv-955aa317-b5c9-45b5-81f0-27dfd2e0f3a1/lib/python3.11/site-packages/sempy_labs/_helper_functions.py:847, in resolve_workspace_name(workspace_id)
846 try:
--> 847 response = _base_api(
848 request=f"/v1/workspaces/{workspace_id}", client="fabric_sp"
849 ).json()
850 except FabricHTTPException:
File /nfs4/pyenv-955aa317-b5c9-45b5-81f0-27dfd2e0f3a1/lib/python3.11/site-packages/sempy_labs/_helper_functions.py:1758, in _base_api(request, client, method, payload, status_codes, uses_pagination, lro_return_json, lro_return_status_code)
1757 if method == "get":
-> 1758 response = c.get(request)
1759 elif method == "delete":
File /nfs4/pyenv-955aa317-b5c9-45b5-81f0-27dfd2e0f3a1/lib/python3.11/site-packages/sempy/fabric/_client/_rest_client.py:155, in BaseRestClient.get(self, path_or_url, *args, **kwargs)
137 """
138 GET request to the Fabric and PowerBI REST API.
139
(...)
153 The response from the REST API.
154 """
--> 155 return self.request("GET", path_or_url, *args, **kwargs)
File /nfs4/pyenv-955aa317-b5c9-45b5-81f0-27dfd2e0f3a1/lib/python3.11/site-packages/sempy/fabric/_client/_rest_client.py:323, in FabricRestClient.request(self, method, path_or_url, lro_wait, lro_max_attempts, lro_operation_name, *args, **kwargs)
298 """
299 Request to the Fabric REST API.
300
(...)
321 The response from the REST API.
322 """
--> 323 response = super().request(method, path_or_url, *args, **kwargs)
325 if not lro_wait or response.status_code != 202:
File /nfs4/pyenv-955aa317-b5c9-45b5-81f0-27dfd2e0f3a1/lib/python3.11/site-packages/sempy/fabric/_client/_rest_client.py:134, in BaseRestClient.request(self, method, path_or_url, *args, **kwargs)
132 kwargs["headers"] = headers
--> 134 return self.http.request(method, *args, **kwargs)
File ~/cluster-env/trident_env/lib/python3.11/site-packages/requests/sessions.py:589, in Session.request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
588 send_kwargs.update(settings)
--> 589 resp = self.send(prep, **send_kwargs)
591 return resp
File ~/cluster-env/trident_env/lib/python3.11/site-packages/requests/sessions.py:710, in Session.send(self, request, **kwargs)
709 # Response manipulation hooks
--> 710 r = dispatch_hook("response", hooks, r, **kwargs)
712 # Persist cookies
File ~/cluster-env/trident_env/lib/python3.11/site-packages/requests/hooks.py:30, in dispatch_hook(key, hooks, hook_data, **kwargs)
29 for hook in hooks:
---> 30 _hook_data = hook(hook_data, **kwargs)
31 if _hook_data is not None:
File /nfs4/pyenv-955aa317-b5c9-45b5-81f0-27dfd2e0f3a1/lib/python3.11/site-packages/sempy/_utils/_log.py:357, in mds_log..get_wrapper..log_decorator_wrapper(*args, **kwargs)
356 try:
--> 357 result = func(*args, **kwargs)
359 # The invocation for get_message_dict moves after the function
360 # so it can access the state after the method call
File /nfs4/pyenv-955aa317-b5c9-45b5-81f0-27dfd2e0f3a1/lib/python3.11/site-packages/sempy/fabric/_client/_rest_client.py:73, in BaseRestClient.init..validate_rest_response(response, *args, **kwargs)
72 if response.status_code >= 400:
---> 73 raise FabricHTTPException(response)
FabricHTTPException: 403 Forbidden for url: https://api.fabric.microsoft.com//v1/workspaces/ebc76500-
Error: {"requestId":"312f9aca-3959-4653-ad3a-c4f4495b7098","errorCode":"InsufficientPrivileges","message":"The caller does not have sufficient permissions to access the requested resource","relatedResource":{"resourceId":"ebc76500-","resourceType":"Workspace"}}
Headers: {'Cache-Control': 'no-store, must-revalidate, no-cache', 'Pragma': 'no-cache', 'Transfer-Encoding': 'chunked', 'Content-Type': 'application/json; charset=utf-8', 'x-ms-public-api-error-code': 'InsufficientPrivileges', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains', 'X-Frame-Options': 'deny', 'X-Content-Type-Options': 'nosniff', 'RequestId': '312f9aca-3959-4653-ad3a-c4f4495b7098', 'Access-Control-Expose-Headers': 'RequestId', 'Date': 'Thu, 13 Mar 2025 08:14:04 GMT'}
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
Cell In[28], line 7
1 with labs.service_principal_authentication(
2 key_vault_uri=key_vault_uri,
3 key_vault_tenant_id=key_vault_tenant_id,
4 key_vault_client_id=key_vault_client_id,
5 key_vault_client_secret=key_vault_client_secret):
----> 7 df = labs.list_workspace_users()
8 display(df)
File /nfs4/pyenv-955aa317-b5c9-45b5-81f0-27dfd2e0f3a1/lib/python3.11/site-packages/sempy_labs/_workspaces.py:126, in list_workspace_users(workspace)
105 def list_workspace_users(workspace: Optional[str | UUID] = None) -> pd.DataFrame:
106 """
107 A list of all the users of a workspace and their roles.
108
(...)
123 A pandas dataframe the users of a workspace and their properties.
124 """
--> 126 (workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
128 columns = {
129 "User Name": "string",
130 "Email Address": "string",
(...)
133 "User ID": "string",
134 }
135 df = _create_dataframe(columns=columns)
File /nfs4/pyenv-955aa317-b5c9-45b5-81f0-27dfd2e0f3a1/lib/python3.11/site-packages/sempy_labs/_helper_functions.py:879, in resolve_workspace_name_and_id(workspace)
877 if workspace is None:
878 workspace_id = _get_fabric_context_setting(name="trident.workspace.id")
--> 879 workspace_name = resolve_workspace_name(workspace_id)
880 elif _is_valid_uuid(workspace):
881 workspace_id = workspace
File /nfs4/pyenv-955aa317-b5c9-45b5-81f0-27dfd2e0f3a1/lib/python3.11/site-packages/sempy_labs/_helper_functions.py:851, in resolve_workspace_name(workspace_id)
847 response = _base_api(
848 request=f"/v1/workspaces/{workspace_id}", client="fabric_sp"
849 ).json()
850 except FabricHTTPException:
--> 851 raise ValueError(
852 f"{icons.red_dot} The '{workspace_id}' workspace was not found."
853 )
855 return response.get("displayName")
ValueError: 🔴 The 'ebc76500-' workspace was not found.
Running the same command from the admin package is producing the same error
