How to add powerbi URL to Cross-Origin Resource Sharing (CORS) policy
search cancel

How to add powerbi URL to Cross-Origin Resource Sharing (CORS) policy

book

Article ID: 188419

calendar_today

Updated On:

Products

Clarity PPM SaaS Clarity PPM On Premise

Issue/Introduction

Require the following URLs to be added to the CORS policy using the admin command. 
api.powerbi.com, app.powerbi.com

Because the following error occurs.

Refused to connect to 'https://api.powerbi.com' because it violates the following Content Security Policy directive: "connect-src 'self' cdnjs.cloudflare.com docops.ca.com fonts.googleapis.com techdocs.broadcom.com".

Resolution

Add api.powerbi.com, app.powerbi.com to the CORS policy using the admin command. 

>admin system-options -add CONTENT_SECURITY_DOMAINS api.powerbi.com -multi
>admin system-options -add CONTENT_SECURITY_DOMAINS app.powerbi.com -multi

If it returns the following messages, try to perform below steps.

Option value already exist for CONTENT_SECURITY_DOMAINS. If it is a multi entry option pass true for multi entry else please remove it before adding or use the force flag.
Error occurred: Option value already exist for CONTENT_SECURITY_DOMAINS. If it is a multi entry option pass true for multi entry else please remove it before adding or use the force flag.
Check admin.log or use -verbose for more information.


1. get current CONTENT_SECURITY_DOMAINS entries.

>admin system-options -list CONTENT_SECURITY_DOMAINS
>Below are the values for system option: CONTENT_SECURITY_DOMAINS
>CONTENT_SECURITY_DOMAINS: 'self'
>CONTENT_SECURITY_DOMAINS: cdnjs.cloudflare.com
>CONTENT_SECURITY_DOMAINS: fonts.googleapis.com
>CONTENT_SECURITY_DOMAINS: techdocs.broadcom.com

2. delete all entries
>admin system-options -delete CONTENT_SECURITY_DOMAINS

3. Re-add entries.
>admin system-options -add CONTENT_SECURITY_DOMAINS "'self'" -multi
>admin system-options -add CONTENT_SECURITY_DOMAINS cdnjs.cloudflare.com -multi
>admin system-options -add CONTENT_SECURITY_DOMAINS fonts.googleapis.com -multi
>admin system-options -add CONTENT_SECURITY_DOMAINS techdocs.broadcom.com -multi
>admin system-options -add CONTENT_SECURITY_DOMAINS api.powerbi.com -multi
>admin system-options -add CONTENT_SECURITY_DOMAINS app.powerbi.com -multi

4. Restart services