Forum Discussion

ArthurL's avatar
ArthurL
Regular Visitor
4 years ago

Call dataset refresh with POSTMAN API call using client secret, please help

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

 

6 Replies