Forum Discussion
Web V2 connection problem
- 1 year ago
Hello,
I recreated my report from scratch and my problem solved itself, without any change in PowerQuery. Thanks for the help !
Hi Pronocalme ,
The issue you're facing with the Web V2 connection reverting to a basic Web connection in Power BI Service is common when using advanced Web connections with custom headers or Bearer tokens. Here's how to resolve it:
Solution:
Use a Parameter for the Bearer Token:
- In Power BI Desktop, create a parameter to hold your Bearer token (e.g., BearerToken).
- Use this parameter in your advanced Web connection query, ensuring it dynamically inserts the token.
Configure the Query Properly:
- Ensure your query uses the Web.Contents function with headers properly set:
let
Source = Web.Contents(
"your-api-endpoint",
[
Headers = [
Authorization = "Bearer " & Parameters[BearerToken]
]
]
)
in
Source
Publish to Power BI Service:
- After ensuring the query works in Power BI Desktop, publish your report.
Set Up the Data Source Credentials in Power BI Service:In Power BI Service, go to Settings > Datasets > Data source credentials.
- Select the authentication method as Anonymous (since the Bearer token is passed in the query itself).
Alternative: Use a Custom Connector:
- If this problem persists, consider creating a custom Power BI connector that supports Web V2 connections. This allows you to define the token logic and headers directly in the connector.
Consider Using a Gateway:
- If your API requires a specific authentication setup that cannot be handled by the Power BI Service, you can set up an On-Premises Data Gateway and configure the connection there.
Key Points:
- The Power BI Service often simplifies connections to basic Web connections, which is why advanced headers like Bearer tokens may fail.
- Using parameters or a custom connector provides a workaround for maintaining advanced Web V2 connection logic.
Please mark this as solution if it helps you. Appreciate Kudos.
ChatGPT is wrong here
Authorization = "Bearer " & Parameters[BearerToken]
Should be
Authorization = "Bearer " & BearerToken- FarhanJeelani1 year agoSuper User
If BearerToken is directly declared as a parameter in Power BI, we can use it without Parameters[].
But, If it's part of a custom table or query, Parameters[BearerToken] might apply.