Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowData Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more
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.