Can't get client-credentials access token to authorize Power BI
Make sure that your app that you registered with AAD has the read write all datasets permission. That should solve the problem.
This is not an answer but one step forward in the debug process. I think the resource for which the token is requested should be "https://analysis.windows.net/powerbi/api". I've seen these in multiple references; one of them is linked below. Even after changing this, I still get a 403. As the OP mentioned if we use the accessToken from the powerBI portal, everything works.
So I tried this with my own app, the following command works (for me): curl -vv -X GET https://api.powerbi.com/v1.0/myorg/datasets -H"Authorization: Bearer ey....qqqq" BTW, the extra "v" after -v seems redundant. So what I can conclude is that your application is missing the required permissions to call Power BI's APIs. One thing you might try is grab one of our samples, create a new application in AAD for it, and then see if the authorization token works for it. Here's a good one to try: https://github.com/PowerBI/Integrate-a-tile-into-an-app
Set up Azure Service Fabric cluster on managed disks
How to find if a Virtual Machine is using managed/Unmanaged disks in Azure
Google Cloud equivalent of Azure's Data Science VM
Can not reference GeoSpatial type Point in Azure functions [duplicate]
Copying file contents from Azure Storage to Azure SQL Db using Azure Data Factory
Azure App service API app host vs API app
Cron jobs in Azure: Automation, Scheduler, WebJobs or other solution?
Azure App Service - Issue with upload files via SSL
Bibucket failed to deploy to azure “Failed to acquire content from your repository”
How to pass Body Parameters to Post operation using API Management Action in Logic App?
Azure AD Web App with zombie Login Redirect Loop
External authentication not working when configured in 'Authentication / Authorization' settings of Azure portal
How to iterate through all files in sftp folder in Microsoft Azure Logic App
Set VSO build/release number as Azure application setting
How to increase size of OS disk in Windows Azure using Powershell
Azure - Managed Disks, how to create snapshot