Power BI REST API: How to get authentication token with PowerShell Cmdlets

You may also like...

4 Responses

  1. Beau Raines says:

    Thanks for this information. Your post seems to be the only place on the internet, MS docs included where this can be found.

    I noted that if you change

    Login-PowerBI -Credential $credential



    It will trigger the device login method where you have to enter a code online. While interactive, it does work with MFA.

    • Alex says:

      Yes, the change you mention might trigger the manual login (could be MFA), but that won’t work for fully automated scripts. If it matches your needs, thats great 🙂
      Cheers! ☺️

  2. Ranganath S says:

    What could be the reason to get ‘“Login-PowerBI : Failed to get ADAL token […]”’ error? How do we resolve it?

    • Alex says:

      The message is pretty generic and indicates an authentication failure. There could be many reasons for that…
      Try to run the same code by replacing “Login-PowerBI -Credential $credential” with “Login-PowerBI” … this will prompt you for the credentials. Make sure the credentials are correct and you don’t have Multi Factor Authentication enabled.

Leave a Reply