Power Query Problems

Fix Power Query Cannot Authenticate to Azure AD REST API

Nimra MalikNimra Malik Oct 10, 2026 870 views

Question details

The user is unable to authenticate Power Query to an Azure AD secured REST API due to an invalid audience error, even though the same API URL works successfully in a web browser.

Fix Power Query Authentication Errors with Azure AD REST APIs
Product
Microsoft Excel
Device & OS
not provided
Scenario
Connecting Power Query to a custom REST service secured by Azure Active Directory.
Observed behavior
Power Query fails to authenticate and reports an invalid audience error because the Azure AD access token was issued for a different API or resource than the REST service expects.
Before you start

Ensure you have administrative access to the Azure Portal and sufficient permissions to view or modify App Registrations, API scopes, and application consent settings.

Solution 1Recommended

Verify Application ID URI and Token Audience

Check that the access token's audience (aud claim) perfectly matches the Application ID URI expected by the REST API.

When Power Query requests an access token from Azure AD, it specifies a resource. If this resource does not match the exact Application ID URI configured in the API's app registration, the resulting token will have an invalid audience claim, causing the REST API to reject the connection.

1
Locate the App Registration

Log in to the Azure Portal, navigate to Azure Active Directory, and select App registrations. Find and open the registration for your REST API.

2
Check the Application ID URI

Navigate to the 'Expose an API' blade and note the exact Application ID URI. This is the identifier the token must be issued for.

3
Verify Power Query Resource Request

Check your Power Query Web.Contents configuration to ensure the 'Resource' parameter exactly matches the Application ID URI found in Azure.

4
Inspect the Token

If you are able to capture the token being sent by Power Query, decode it using a JWT decoder tool to verify that the 'aud' claim matches your API's Application ID URI.

Verify Application ID URI and Token Audience
Web Browser Differences: Browsers often request tokens for the web frontend client rather than the backend REST API directly. This is why the browser can successfully authenticate while Power Query fails.
Free Microsoft Office alternative

Try WPS Office for Your Data Management Needs

If you are tired of dealing with complex Microsoft Office integration issues or backend authentication setups, consider WPS Office. It provides a highly compatible, lightweight, and free alternative to Excel for most data analysis, spreadsheet management, and reporting tasks.

  1. 1. Download the software: Visit the official WPS Office website and download the free installer for your operating system.
  2. 2. Install WPS Office: Run the installer and follow the on-screen prompts to set up the software in just a few clicks.
  3. 3. Open your workbooks: Launch WPS Spreadsheet and open your existing Excel data files directly to continue your analysis seamlessly.
Fully compatible with Microsoft Excel (.xlsx, .xls) formatsFree, lightweight, and faster to launch than Microsoft OfficeBuilt-in advanced formulas and intuitive data analysis toolsFamiliar user interface requiring almost no learning curve
microsoft office alternative - wps office

Frequently Asked Questions

Why does the Azure AD REST API work in my web browser but fail in Power Query?

Web browsers and Power Query request access tokens differently. The browser usually requests a token intended for a web frontend application, while Power Query requests a token for the backend REST API directly. If the token audiences do not match, Power Query receives an invalid audience error.

How do I fix the invalid audience error in Power Query?

You need to ensure that the App Registration for your API in Azure exposes the correct Application ID URI, and that your Power Query configuration specifically requests a token using that exact URI as the resource.

What tool can I use to inspect my Azure AD access token?

You can use a proxy tool to capture the Bearer token being sent by Power Query, and then paste that token string into a JWT decoding website like jwt.ms to safely inspect the 'aud' (audience) claim without exposing your credentials.