Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
We are getting a CORS (cross-origin resource sharing) error while calling an API from a Power BI custom visual. We are getting this error from only one domain, both in the Power BI Service and on the Desktop.
(Error: Access to XMLHttpRequest at 'xxxxxx' from origin 'null' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource).
We checked this custom visual in other domains of the Power BI service, API calls were successful, and the visual is rendering as expected.
We checked that ‘Access-Control-Allow-Origin’ as ‘*’ is enabled in the API call header and in the Backend as well.
Please let us know if we need to change any settings in Power BI to overcome this issue or if there is any other approach for resolving the issue.
The CORS error occurs when a web application makes a request to a resource on a different domain or port. In this case, the API endpoint you are trying to access is not allowing access from the domain you are using in the Power BI visual.
To resolve this issue, you need to configure the API to allow access from the domain or origin where your Power BI visual is hosted. You can do this by adding the domain or origin to the 'Access-Control-Allow-Origin' header in the API response.
Additionally, you can try to add the following header in the API response to allow credentials (if needed):
'Access-Control-Allow-Credentials': 'true'
If the issue still persists, you can try enabling the 'Allow any embedding' option in the Power BI report settings. This will allow the visual to load from any domain without any restrictions.
To enable this option, go to the report settings in the Power BI Service and under the 'Security' tab, toggle the 'Allow any embedding' option to 'On'.
Please note that enabling this option can pose security risks, so use it carefully and only if necessary.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
4 | |
3 | |
3 | |
3 | |
3 |