Power Query Problems

Troubleshoot Excel Power Query Web Queries with Azure AD Authentication

Olivia MillerOlivia Miller Nov 12, 2026 870 views

Question details

The user needs to identify why an Excel Power Query web query cannot connect to a REST API that works successfully in a web browser.

Troubleshoot Excel Power Query Web Queries with Azure AD Authentication
Product
Microsoft Excel Power Query and an Azure AD-protected REST API
Device & OS
not provided
Scenario
Connecting Excel Power Query to a REST API that returns JSON data and requires Azure Active Directory authentication.
Observed behavior
The API endpoint works in a browser, but the Excel web query fails because Power Query may not have the same authentication session, token, permissions, headers, or supported sign-in flow.
Before you start

Collect the exact Power Query error message and the API response or Azure AD error code. Confirm the endpoint URL, expected authentication method, tenant ID, API audience, and required OAuth scopes with the API administrator.

Solution 1Recommended

Verify the Power Query API URL, headers, and authentication configuration

Use this approach when the API works in a browser but Power Query cannot retrieve the JSON response.

A browser can send existing sign-in cookies or a cached Azure AD session automatically. Power Query uses its own data-source credentials and may require a supported organizational account flow, anonymous access, or explicitly supplied request headers.

1
Test the exact API endpoint

In Excel, open Data > Get Data > From Other Sources > From Web, then paste the exact REST API URL. Verify that the URL is the API endpoint rather than a browser-only application page.

2
Review data-source permissions

Go to Data > Get Data > Data Source Settings, select the API URL or base domain, and choose Edit Permissions. Confirm that the selected authentication type matches the API requirement, such as Organizational account, Web API, or Anonymous.

3
Sign in with the correct work account

If the API uses Azure AD organizational authentication, select Organizational account in the credentials dialog and sign in with an account from the required tenant. Remove incorrect saved credentials in Data Source Settings before trying again.

4
Check required request headers

In Power Query Editor, open Home > Advanced Editor and review the Web.Contents request. Confirm that required headers, such as Accept: application/json or an approved Authorization header, match the API documentation.

5
Inspect the returned error details

In Power Query Editor, select the failed query and review the error details. Compare Azure AD messages such as invalid audience, insufficient privileges, invalid tenant, or missing scope with the API registration settings.

Verify the Power Query API URL, headers, and authentication configuration
Browser access does not confirm Power Query access: A successful browser request may rely on cookies, redirects, or interactive sign-in behavior that the Power Query connector does not use or support.
Free Microsoft Office alternative

Use WPS Office for Everyday Spreadsheet Work While Resolving Excel API Access

Azure AD authentication behavior for Excel Power Query is controlled by Microsoft Excel, the API, and Microsoft Entra ID configuration. While the connection issue is being resolved with the API administrator, WPS Office provides a free, lightweight spreadsheet alternative with a familiar interface and straightforward migration for standard Excel files.

Free and lightweight spreadsheet software for everyday data review and reporting.Opens and saves Microsoft Excel XLS and XLSX files with strong format compatibility.Provides a familiar spreadsheet interface for formulas, tables, charts, and workbook editing.Lets you continue working with exported JSON or CSV API data after it is provided.
QA img-9

Frequently Asked Questions

Why does an Azure AD-protected API work in my browser but fail in Excel Power Query?

Your browser may already have Azure AD cookies or an active sign-in session. Power Query uses separate credentials configured under Data > Get Data > Data Source Settings and may not use the same cookies or interactive sign-in flow.

Where can I change authentication credentials for a Power Query web request?

In Excel, go to Data > Get Data > Data Source Settings. Select the API URL or domain, choose Edit Permissions, and select the appropriate authentication method. Use Clear Permissions first if Excel keeps using an incorrect saved account.

What Azure AD settings should I check for a 401 or 403 API error?

Check the tenant, token audience, exposed API scopes, assigned roles, API permissions, and admin consent in Microsoft Entra ID > App registrations. Also verify that the signed-in Excel account is authorized to access the API.

Can I send an Authorization header from Power Query?

You can define headers in an M query with Web.Contents in Power Query Editor > Home > Advanced Editor, subject to your organization's security requirements. Confirm with the API owner whether Power Query's authentication flow and token handling are supported.

What information should I provide when asking for help with a Power Query API connection?

Provide the sanitized Power Query M code, full error message, endpoint base URL, selected authentication method, expected headers, tenant type, required API scopes, and a sample JSON response without credentials or sensitive data.