Others

Fix Power BI REST API 401 Unauthorized for Daemon Application

Bushra ParveenBushra Parveen Nov 3, 2026 872 views

Question details

The user is encountering an HTTP 401 Unauthorized error when attempting to use the Power BI REST API with a daemon application.

How to Fix Power BI REST API Returns 401 for a Daemon Application
Product
Power BI
Device & OS
not provided
Scenario
Accessing Power BI data programmatically using a daemon app with app-only tokens and the .default scope.
Observed behavior
The API returns an HTTP 401 Unauthorized error because the service principal access, tenant settings, or application permissions are not configured correctly.
Before you start

Ensure you have Power BI Administrator privileges or can contact your tenant administrator, as resolving this requires accessing Microsoft Entra ID (Azure AD) and the Power BI Admin portal.

Solution 1Recommended

Enable Service Principal Access in Power BI Tenant Settings

Resolve the 401 error by ensuring the service principal is allowed to use Power BI APIs and has explicit access to the target workspace.

Daemon applications use app-only tokens which identify as service principals. By default, Power BI blocks service principals from utilizing its REST APIs. You must explicitly allow them in the admin portal.

1
Access the Admin Portal

Log into the Power BI service using an account with Power BI Administrator privileges and open the Admin portal from the settings gear icon.

2
Enable Developer Settings

Navigate to 'Tenant settings' and scroll down to locate the 'Developer settings' section.

3
Allow Service Principals

Toggle 'Allow service principals to use Power BI APIs' to Enabled. You can apply this to the entire organization or specific security groups.

4
Grant Workspace Access

Go to the specific Power BI workspace your app is trying to access, click 'Access', and add the service principal (app name) as a Member or Admin.

Enable Service Principal Access in Power BI Tenant Settings
Community Support: For highly specific authentication and authorization questions outside standard setups, consult the official Power BI Community forums.
Free Microsoft Office alternative

Need a seamless way to handle your local data and reports? Try WPS Office

While Power BI handles complex cloud dashboards, WPS Spreadsheet offers a powerful, lightweight, and free solution for offline data analysis, reporting, and visualization. It perfectly supplements your data workflow without complex API configurations.

  1. 1. Download the Installer: Visit the official WPS Office website and download the free installation package for your operating system.
  2. 2. Install WPS Office: Run the downloaded installer and follow the simple on-screen instructions to set up the software.
  3. 3. Start Analyzing Data: Open WPS Spreadsheet to import your CSV or Excel exports from Power BI and begin your local data analysis seamlessly.
High compatibility with Microsoft Excel (.xlsx, .csv) and other Office formats.Advanced offline data analysis tools including PivotTables, charts, and complex formulas.Lightweight installation with zero complex API or tenant configurations required.Familiar user interface ensuring seamless migration and zero learning curve.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my daemon app work with delegated permissions but get 401 with app-only tokens?

App-only tokens require Application-level permissions in Azure AD and explicit Admin consent. Additionally, the service principal must be specifically enabled in the Power BI tenant settings under 'Allow service principals to use Power BI APIs'.

Can I use the Dataset.ReadWrite.All scope for every Power BI API scenario?

No, certain Power BI REST APIs do not support the Dataset.ReadWrite.All scope, particularly those outside specific dataset operations. You must verify the exact scope requirements for your specific endpoint in the official REST API documentation.

What scope should I request when generating the token for my daemon application?

For daemon applications utilizing the client credentials flow to get an app-only token, you should use the https://analysis.windows.net/powerbi/api/.default scope. This scope dynamically uses the permissions explicitly granted to the application in Azure AD.