Forum Discussion
How to automatically add service principal to workspaces
Hi cmjcf ,
According to your question, you want to inquire about getting a way to add a given SP to any workspaces it is not already in, without real-user credentials. Based on my search and research so far, adding it manually in the UI is not possible, but you can consider using PowerShell or Rest API to test if it works.
Groups - Add Group User - REST API (Power BI Power BI REST APIs) | Microsoft Learn
required scope is Workspace.ReadWrite.All
This API call can be called by a service principal profile. For more information see: Service principal profiles in Power BI Embedded.
Learn how to authenticate for embedded analytics by using a Microsoft Entra application service principal and an application secret.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- cmjcf1 year agoFrequent Visitor
Workspace.ReadWrite.All does not appear to be available as an application permission:
I tried adding it as a delegated permission anyway, but that didn't work either. The API still returns "Unauthorized".