Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello Power BI Community,
I am experiencing difficulty with authenticating API requests using the OAuth 2.0 client credentials grant type for the Power BI REST API. I am attempting to access the API at https://api.powerbi.com/v1.0/myorg/datasets, which requires authentication tokens that I am trying to retrieve via Azure Active Directory (Azure AD).
Here is a breakdown of the steps I've followed:
Application Registration: I registered my application in Azure AD, ensuring it has the necessary API permissions for Power BI (e.g., Dataset.Read.All).
Token Request: I am using the endpoint https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token for token generation. Here’s the curl command I use (with sensitive data omitted):curl -X POST https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "client_id={client_id}" \
-d "client_secret={client_secret}" \
-d "grant_type=client_credentials" \
-d "scope=https://analysis.windows.net/powerbi/api/.default"
401 Unauthorized Error: Despite following all documented steps and verifying that the client ID, secret, and tenant ID are correct, I receive a 401 Unauthorized error when I attempt to use the generated token to make API requests.
Here are some additional details:
There are no alerts or incidents reported on the Azure status page that indicate an ongoing issue with Azure AD or Power BI services.
Questions:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.