Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello!
I have problem trying to execute dataset refresh using POSTMAN api calls (for test purpose).
Clients POWER BI admin provided me with client id, tenant id, group id, dataset id and client secret.
The tenant settings in the Admin portal are enabled.
Now my actions:
First I generate Bearer token, using https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow as example
Method: post
url: https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token
headers: Content-Type: application/x-www-form-urlencoded
body:
client_id={clientId}
&client_secret={clientSecret}
&scope=https://analysis.windows.net/powerbi/api/.default
&grant_type=client_credentials
I get response 200 and token.
Then API call to refresh daset
Method: get
url: https://api.powerbi.com/v1.0/myorg/groups/{group_id}/datasets/{dataset-id}/refreshes
headers Authorization: Bearer {token}
But i get response 401 -
x-powerbi-error-info: | ServicePrincipalIsNotAllowedByTenantAdminSwitch |
I want to know if problem is from my side or something wasn’t done correctly while registering app in POWER BI or setuping in Azure.
If it is from my side were I did go wrong?
P.S. Client does not want to use login and password
Helllo @ArthurL
I have finally resolved my issue with postman calls, please have a look at resolution posted under below post.
Hi! 401 means the accounts doesn't have the authority to make the action. That sounds like you haven't added the service principal to the workspace you are reaching to execute the refresh. (Admin or member, not viewer)
You also need to validate that the PowerBi Admin Portal tenant settings have the Service Principal usage of API enabled.
I guess one of those two might be the problem,
I hope that helps,
Happy to help!
Hello!
Thank you for your answer.
Their admin added app to workspaces, but I still get the error 401
Hi @ArthurL ,
The documentation at Datasets - Refresh Dataset In Group - REST API (Power BI Power BI REST APIs) | Microsoft Docs It says that you need to use a POST request. In your original question, you say you use GET.
Further as suggested by @ibarrau check if the "Allow service principals to use Power BI APIs" setting is enabled and that the service principal is added to the correct security group
Kinds regards
Thank you for noticing that I used GET instead of POST.
But still error remains the same 401.
Next week I will have meeting with their BI admin and we will go step by step instruction to see what we missed.
I’ll update pos after that if managed to find something
Were you able to get resolution for this issue, I am having similar problem during generating EmbedToken, my post is below. For me somehow it is not able to reach the host and througing HTTP 400 Error
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.