Forum Discussion
Power bi Refresh API service principle
Trying to build a step into my data pipeline that could refresh the power bi report. I have made it to this far that my AAD Client ID triggers the refresh, but it always asks my personal password, plus the mfa. Is there a way to use a service principale or something that wouldn't require a personal password?
5 Replies
- JayendranSolution Sage
Hi Anonymous ,
Yes you can use the Service principal to call the Refresh API
POST https://api.powerbi.com/v1.0/myorg/groups/{groupId}/datasets/{datasetId}/refreshesBut before you call the refresh API the SPN needs to takeover the dataset, for that you can call the below API
POST https://api.powerbi.com/v1.0/myorg/groups/{groupId}/datasets/{datasetId}/Default.TakeOverAll the above API needs to call using the SPN credentials.
- AnonymousNot applicable
Thanks for getting back to me. How did you do the authentication?
- AnonymousNot applicable
Maybe this can give you an idea: https://docs.microsoft.com/en-us/power-bi/developer/get-azuread-access-token#access-token-with-service-principal
I can't explain more without knowing how you're implementing this.
I'm using the Power BI Nuget package to perform changes like yours using the Service Principal. I tried using Postman but I couldn't get the AAD token: "AADSTS500011: The resource principal named https://analysis.windows.net/powerbi/api/ was not found in the tenant named .... This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have sent your authentication request to the wrong tenant