Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
burgerboyy
New Member

Privileges settings for Power BI visual not working?

Hi,

 

I'm currently building a custom visual that makes use of the google maps API - as such, I've set privileges in the capabilities.json to allow for WebAccess. However, whenever testing my visual in PowerBI service, I get the following when inspecting the sandbox div:

 

Refused to load the script 'https://maps.googleapis.com/maps/api/js?key=YOUR_KEY' because it violates the following Content Security Policy directive: "default-src 'self' data: blob: 'unsafe-inline' 'unsafe-eval'". Note that 'script-src-elem' was not explicitly set, so 'default-src' is used as a fallback.

 

My understanding is that you need to allow for access to external resources by updating permissions in capabilities.json - here is my code:

 

    "privileges": [{
        "name": "WebAccess",
        "essential": true,
        "parameters": [
            "https://*maps.googleapis.com/","https://*maps.googleapis.com/maps-api-v3/","https://*googleapis.com","https://*google.com","https://*geo0.ggpht.com"
        ]

 

 

However, it seems to make no difference regardless of whether I add the WebAccess privilege or not - I cannot call the external js and get the same console error message. What am I missing here?

1 REPLY 1
dpzafra
New Member

Hi, Do you solved the problem, I have a similar problem?

 

I build a custom visual that call a external api with a interval, this is the code:

 

const response = await fetch("http://localhost:3000",{
            method: 'POST',
            headers: {
            'content-type': 'application/json;charset=UTF-8',
            },
            body: JSON.stringify({
                data: column_id
            }),
        });
 
Also add in capabilities.json :
    "privileges": [
        {
            "name": "WebAccess",
            "essential": true,
            "parameters": ["http://localhost:3000"]
        }
 
It works in development mode, but when i build and package the solution it doesn´t in powerbi desktop. 
 
The api is program in node with cors enable and listening in port 3000, http:
app.use(cors({
    origin: '*'
}));
 
Thank you for any help.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.