Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
I’m working on integrating ChatGPT or Google Gemini into Power BI using a custom visual to enable interactive AI responses directly from the report, based on the dataset contents.
Everything works fine when I test the API in Postman, but Power BI blocks the API call from the custom visual due to security restrictions, most likely related to Content Security Policy (CSP) or cross-origin (CORS) issues.
Built a custom visual in Power BI using React and TypeScript
Integrated OpenAI/Gemini API logic inside the visual
Created a proxy API server to forward the API requests
Used tunneling tools like:
localtunnel
ngrok
Cloudflare Tunnel
How can I successfully connect Power BI custom visual to OpenAI/Gemini API through a proxy or tunnel?
Is there a recommended tunneling or reverse proxy approach that works with Power BI visuals?
Any guidance or step-by-step solution would be greatly appreciated!
Thanks!
Solved! Go to Solution.
Hi @jesikamaurya ,
Thanks for reaching out to the Microsoft fabric community forum.
Power BI imposes several restrictions on custom visuals by running them in a sandboxed environment with the least amount of privilege. As a result, any content hosted inside the visual that requires elevated permissions is unlikely to function correctly. This sandboxing also strips away the domain context from custom visuals, preventing them from impersonating powerbi.com. Consequently, attempting to access services or embed content from sites that enforce CORS restrictions will fail within the visual. Since CORS policies are enforced by the target server, they cannot be overridden from the client side, including within the visual itself.
If your endpoint enforces a CORS policy, it won’t be accessible from a Power BI custom visual. Microsoft sandbox custom visuals, which results in requests being sent with a null origin. Even if your code is correct, the target server will block the request due to this null origin unless explicitly allowed, making direct API calls from the visual unsuccessful.
If the ability to call third-party services is important to your use case, we recommend submitting a suggestion in the Power BI Ideas forum.
Fabric Ideas - Microsoft Fabric Community
This platform is actively monitored by the product team, and highly supported posts are often implemented to Power BI.
If you find this post helpful, please mark it as an "Accept as Solution" and consider giving a KUDOS. Feel free to reach out if you need further assistance.
Thank you
I've faced similar CSP/CORS issues when building AI integrations for Power BI. The challenge is that Power BI's security model restricts direct API calls from custom visuals, which is why your proxy approach is on the right track.
One thing that worked for me was setting up a lightweight Azure Function as a secure proxy, it handles the API call and returns the response to the visual without tripping Power BI’s security policies.
If you're looking for a ready-made solution that avoids these integration headaches, you might find PowerMind interesting. It’s a custom AI assistant built specifically for Power BI that embeds directly into dashboards without needing Copilot licenses or dealing with API blockers. You can see a quick demo of how it works here:
Hi @jesikamaurya ,
Could you please confirm if you've submitted this as an idea in the Ideas Forum? If so, sharing the link here would be helpful for other community members who may have similar feedback.
If we don’t hear back, we’ll go ahead and close this thread. For any further discussions or questions, please start a new thread in the Microsoft Fabric Community Forum we’ll be happy to assist.
Thank you for being part of the Microsoft Fabric Community.
Hi @jesikamaurya
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If our responses has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.
Hi @jesikamaurya ,
Thanks for reaching out to the Microsoft fabric community forum.
Power BI imposes several restrictions on custom visuals by running them in a sandboxed environment with the least amount of privilege. As a result, any content hosted inside the visual that requires elevated permissions is unlikely to function correctly. This sandboxing also strips away the domain context from custom visuals, preventing them from impersonating powerbi.com. Consequently, attempting to access services or embed content from sites that enforce CORS restrictions will fail within the visual. Since CORS policies are enforced by the target server, they cannot be overridden from the client side, including within the visual itself.
If your endpoint enforces a CORS policy, it won’t be accessible from a Power BI custom visual. Microsoft sandbox custom visuals, which results in requests being sent with a null origin. Even if your code is correct, the target server will block the request due to this null origin unless explicitly allowed, making direct API calls from the visual unsuccessful.
If the ability to call third-party services is important to your use case, we recommend submitting a suggestion in the Power BI Ideas forum.
Fabric Ideas - Microsoft Fabric Community
This platform is actively monitored by the product team, and highly supported posts are often implemented to Power BI.
If you find this post helpful, please mark it as an "Accept as Solution" and consider giving a KUDOS. Feel free to reach out if you need further assistance.
Thank you
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |