Forum Discussion
Web V2 connection problem
Hello everyone !
I've created a dashboard using a data source from an advanced Web connection, but when I publish this dashboard, the connection becomes a Web connection (and not Web V2 as it should be), so I can't enter a Bearer token and my connection is in error. Do you know how can I solve this issue ?
Thanks !
Hello,
I recreated my report from scratch and my problem solved itself, without any change in PowerQuery. Thanks for the help !
13 Replies
- FarhanJeelaniSuper User
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 SourcePublish 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.
- lbendlinSuper User
ChatGPT is wrong here
Authorization = "Bearer " & Parameters[BearerToken]Should be
Authorization = "Bearer " & BearerToken- FarhanJeelaniSuper 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.
- v-hashadapuCommunity Support
Hi Pronocalme , thank you for reaching out to the Microsoft Fabric Community Forum.
Please consider below:- Ensure that you are using the correct connection type. When setting up the connection in Power BI, make sure you select "Web V2" instead of just "Web”.
- Try recreating the Web V2 connection from scratch. Go to "Get Data" > "Web" > "Advanced" and ensure you select "Web V2" as the connection type.
- When setting up the Web V2 connection, ensure you have the correct URL and headers, including the Bearer token. Double-check the token and ensure it is valid.
- When publishing the report, double-check the publish settings to ensure the connection type remains as Web V2.
- Ensure that you have the necessary permissions to use the Web V2 connection and that the API endpoint you are connecting to supports Web V2.
- If your Bearer token is dynamic or sensitive, consider using a Tableau parameter to store and manage it securely. This parameter can then be used within the Web V2 connection string.
- Verify that your Tableau Server environment is configured correctly to support Web V2 connections and any required authentication methods.
- Review the Tableau Server logs for any error messages related to the Web V2 connection or the published workbook.
- Make sure your Power BI Desktop is up to date. Sometimes, updates include fixes for such issues.
If this helps, please consider marking it 'Accept as Solution' so others with similar queries may find it more easily. If not, please share the details.
Thank you. - PronocalmeFrequent Visitor
Hello,
Thank you ChatGPT and Ibendlin for your replies but it still doesn't work, I can't specify in PowerBI desktop that I want to use a Web V2 connection.
Here is my query :
let Source = Csv.Document(Web.Contents( "my-api-endpoint", [ Headers = [ Authorization = "Bearer " & BearerToken ] ] ), [Delimiter=",", Columns=9, Encoding=65001, QuoteStyle=QuoteStyle.None]) in Source- v-hashadapuCommunity Support
Hi Pronocalme , thank you for reaching out to the Microsoft Fabric Community Forum.
Sorry to know it isn’t working. Please consider below steps to ensure you are using a Web V2 connection.- In Power BI Desktop -> Go to Transform Data -> New source -> web -> Choose Advanced.
- In the "Advanced" settings, ensure that you select "Web V2" as the connection type. If you do not see this option directly, it might be configured within the API key or authentication settings.
- Enter your API endpoint URL in the "URL parts" section.
- Select ‘Add header’ -> Select Authorization in Dropdown (type it in if it's not listed).
- Click "Done" to apply the query.
Power Query Web Connector - Microsoft Learn
https://learn.microsoft.com/en-us/powerquery-m/web-contents
If this helps, please consider marking it 'Accept as Solution' so others with similar queries may find it more easily. If not, please share the details.
Thank you.- PronocalmeFrequent Visitor
Thanks for your reply. Can you please tell me how to select "Web V2" as the connection type as you said there :
"In the "Advanced" settings, ensure that you select "Web V2" as the connection type. If you do not see this option directly, it might be configured within the API key or authentication settings."
- v-hashadapuCommunity Support
Hi Pronocalme , Hope your issue is solved. If it is, please consider marking it 'Accept as solution', so others with similar issues may find it easily. If it isn't, please share the details. Thank you.
- v-hashadapuCommunity Support
Hi Pronocalme , Hope your issue is solved. If it is, please consider marking the answer 'Accept as solution', so others with similar issues may find it easily. If it isn't, please share the details.
Thank you.- PronocalmeFrequent Visitor
Hello,
I recreated my report from scratch and my problem solved itself, without any change in PowerQuery. Thanks for the help !
- DavidLapaMicrosoft Employee
Adding my comment here in case people come to this post looking for information about web vs web v2.
Web v2 (as of now at least) it is not a Power BI connector, but a Fabric Pipeline one (Web activity in pipeline for example). Tagging for awareness as I've just came across with this thread and not all information is accurate. lbendlin Pronocalme