Forum Discussion
Change power bi workspace description via API with service principal - Set-PowerBIWorkspace
Dear Community,
I am attempting to modify the description field of a workspace using a service principal, but I am encountering an error.
Rest API error
"Invoke-RestMethod : The remote server returned an error: (401) Unauthorized."
cmdlet error
"Set-PowerBIWorkspace : Operation returned an invalid status code 'Unauthorized'"
The Set-PowerBIWorkspace documentation states that the service principal requires additional Azure roles and the API Permissions which can be granted on the azure app are not enought
Updates the name or description of a Power BI workspace. Only workspaces in the new workspace experiences preview are supported. Only -Scope Organization is supported and you must have administrator rights (such as Office 365 Global Administrator or Power BI Service Administrator) to call this command. Before you run this command, make sure you log in using Connect-PowerBIServiceAccount.
My Tests
I tried to grant the service princial full access over all API permissions - no success
Additonal granted for the tenant - no success
My questions:
- According to my tests it is not possible to grant azure roles like Office 365 Global Administrator or Power BI Service Administrator to a service principal
- Can a service principal use the Set-PowerBIWorkspace command
- Whats about the contact persons on a workspace are they accessable via API? (I do not know any possibility still wanted to ask)
Thanks in advanced
Manuel
2 Replies
- AnonymousNot applicable
Hi ManuelW ,
According to this official documentation, service principal only supports some read-only admin APIs, that's why you got an unauthorized error when you use service principal to change the workspace description...
And the supported APIs as the ones in the link below:
Best Regards
- ManuelW
Helper I
Dear Anonymous,
thank you for your answers, but these are already mentions from me in my post.
My quetsions are:
My questions:
- According to my tests it is not possible to grant azure roles like Office 365 Global Administrator or Power BI Service Administrator to a service principal
- Can a service principal use the Set-PowerBIWorkspace command
- Whats about the contact persons on a workspace are they accessable via API? (I do not know any possibility still wanted to ask)
Thank you very much, I appreaciate your answer.