Forum Discussion
Trying to add a Service Principal Profile to a Datasource
I'm trying to add a Service Principal Profile to a Datasource using the following request:
await powerBiClient.Gateways.AddDatasourceUserAsync(<gatewayId>, <gatewayDatasourceId>, new DatasourceUser
{
PrincipalType = PrincipalType.App,
Profile = <ServicePrincipalProfile>,
Identifier = <servicePrincipalId>,
DatasourceAccessRight = DatasourceUserAccessRight.Read
});
The request executes without error, however it does nothing. I'd expect the Service Principal Profile to be added to the datasource, but however, it isn't. When requesting the datasource users using the API, I do not see the Service Principal Profile being assigned.
Some further notes:
- The Service Principal Profile instance has been retrieved using the Power BI SDK API.
- Both the Service Principal Profile and the Service Principal have been assigned to a workspace with the dataset in use.
- The Service Principal has been used to create the Service Principal Profile.
- Using the same request to add a Service Principal to a datasource works, so I assume that all other parameters are correct.
I'm all out of ideas and welcoming any feedback on this issue.
3 Replies
- AnonymousNot applicable
HI Anonymous,
I'd like to suggest you take a look the limitations about using service principal if this help with your scenarios:
Regards,
Xiaoxin Sheng
- AnonymousNot applicable
Hi, Anonymous ,
thanks for your swift response. However, I struggle to understand the issue and how the forwarded documentation might help me. If there was a security / permission issue, as the last two bullet points suggest, I'd expect the AddDatasourceUserAsync request to return a HTTP Forbidden/Unauthorized/BadRequest status code. However, the request executes peacefully without any error but does nothing.
Could you explain how the aforementioned documentation might help resolve my issue or how I could proceed otherwise?
On a side note: We already contacted Microsoft support and got told that it's possible to add Service Principle Profiles as a Datasource User using the API call in question. However, noone could explain how to do it properly and why it isn't working the way we expect it to work.
- AnonymousNot applicable
Upon further inspection, this seems to be a bug with the SDK/API from Power BI. The situation is as follows:
- Adding a Service Principal Profile to a datasource the way I described it works peacefully without any error message.
- However, you do not get any information that the user is added, neither via GetDatasourceUsers nor in the Power BI Web UI
- Adding a Service Principal Profile to a datasource seems critical, as without it, binding the datasource to a gateway doesn't work