The documentation also doesn’t really show (or I couldn’t find it), for what audience to request a token. Using a Logic App I eventually got it to work after a lot of trial and error 🙂
For those googling this, I encountered a bunch of these first before finding the right audience of ‘https://api.fabric.microsoft.com’
Http request failed as there is an error getting AD OAuth token: ‘AADSTS500011: The resource principal named https://api.fabric.microsoft.com/.default was not found in the tenant named XXXXX. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have sent your authentication request to the wrong tenant.
Http request failed as there is an error getting AD OAuth token: ‘AADSTS500011: The resource principal named https://api.powerbi.com was not found in the tenant named XXX
Http request failed as there is an error getting AD OAuth token: ‘AADSTS500011: The resource principal named https://analysis.windows.net/powerbi/api/.default was not found in the tenant namedXXX
Http request failed as there is an error getting AD OAuth token: ‘AADSTS500011: The resource principal named https://analysis.windows.net was not found in the tenant named XXX
The PowerBI Import API is quite specific and kept giving me 400’s like:
“Bad Request” with no details
UnknownError pbi.error exceptionCulprit 1 (loved this one)
MultiPartMimeStreamFormatException
RequestedFileIsEncryptedOrCorrupted
Eventually I figured out how to import my reports directly into PowerBI, so to help you automate importing your reports into workspaces or directly to customers using PowerShell, I’ll share my PowerShell function with you: