Forum Discussion
Getting Refused to connect to X because it violates the following Content Security Policy directive
I had the same problem and found out that the issue was the priveleges on the capabilities file.
Updating the API version in Pbiviz code from 3.8.0 to 5.1.0 has triggered a Content-Security-Policy 'connect-src' error. This issue arises because the newer API version requires specifying explicit privileges for accessing external resources.
In the current environment, if your Power BI visual needs to fetch content from external sources, you must explicitly define the sites from which you intend to retrieve content in the privileges section of the capabilities file.
{
"name": "WebAccess",
"essential": true,
"parameters": [ "https://*.microsoft.com", "http://example.com" ]
}
As a workaround, you might consider granting privileges to all HTTPS websites, but this approach could potentially introduce security concerns.
"privileges":[
{
"name": "WebAccess",
"essential": true,
"parameters": [ "https://*.microsoft.com", "https://*"]
}]
You can find more information about the privileges here.