Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Power BI Rest API wont accept Application Token

I have multiple Admin API calls in my pbix that run just fine if I use my own or the ServiceAccount token generated using PowerShell.   But as soon as I try to substitute in the Access Token I get ...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Solution found thanks to SpartaBI !

     

    1. Go to App registration -> New registration

     

    2. Give your app a name and use the default settings

     


    3. Create a secret, and make sure you copy the right value

     

     


    4. Copy the ClientId & TenantId

     

    No need to do anything else with the app config.

    Just add "MyNewApp" to the AAD security group, wait for a couple of minutes, then try your code.

     

    Then for running a Non-Admin API call, the App needs added into the Workspace Permissions you want to read from.

     

    You do not need to add any delegated permissions to the app.
    In order to allow a service principal access no non-admin APIs, it must have the same dataset/workspace permissions as any other user. For example- you can add the service principal as a member of a workspace.

     



    This is exactly the purpose of the other setting in the Admin Portal.
    It defines the service principals whose permissions are being managed by the Power BI Service itself.