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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
frankyhc
Frequent Visitor

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 8
lbendlin
Super User
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.

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?

Hi @frankyhc ,

Please open Admin Portal by using  global admin account to enter.

11.PNG

Please refer to the following document about audit logs to see if it helps you.

https://docs.microsoft.com/power-bi/admin/service-admin-auditing

 

Best Regards

Community Support Team _ Polly

 

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

Hi,

 

Actually my question is how to get current login user's workspace, not ask how to get audit log.

I am Power BI Service admin, and then not able to get audit log. I viewed the documentation you sent, it seems like only get user's recent activity.

I assume you are on Premium. You need to include a step to promote you users' workspaces from shared to premium.

Don't allow your users to pick a capacity. That is a job for the Power BI service admin.

I am Power BI Service admin, i want to automate the assignment process instead of my manual operation.

I would like to implement an order form to trigger REST API, let user to select workspace from their owned or accessiable ones, submit form and after approval, capacity is assigned automatically

I would propose you look into the tenant inventory logs again. WorkspacesUsers has the mapping. Then you could use a PowerApp to collect their input and Power Automate to run the approval workflow.

Ask your tenant admin to help you.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors
Top Kudoed Authors