Forum Discussion
How to get current login-user's workspace
I would like to automate the capacity ordering and assignment process instead of admin manually assignment.
Step1: End user open an order form, and it will display all his workspace he own as admin
Step2: He could select relevant workspace and our orgnization owned capacity and click submit
Step3: After necessary approval, assignment would be processed automatically.
But I stuck in how to get current login user's workspace.
Below API can only return back all the workspaces, not easily to return login-users workspace.
https://docs.microsoft.com/en-us/rest/api/power-bi/admin/groups-get-groups-as-admin
Below is an API to return back API caller's workspace. But how to get current login-user's token to call such API is a problem.
https://docs.microsoft.com/en-us/rest/api/power-bi/groups/get-groups
Anyone has idea about it?
8 Replies
- lbendlin
Super User
Even when you do that you won't know if they are admin or editor/contributor. We use the Tenant Audit log (WorkspacesUsers) for these purposes. That log includes the role type.
- frankyhcFrequent Visitor
Could use below api to get user role.
https://docs.microsoft.com/en-us/rest/api/power-bi/groups/get-group-users
May I know how to get "Tenant Audit log", what are those details inside?
- lbendlin
Super User
Ask your tenant admin to help you.