An Azure service that provides a hybrid, multi-cloud management platform for APIs.
Hi @Neelavathy
Thank you for reaching out to Microsoft Q&A.
In Azure API Management (APIM), the Developer Portal supports Content Security Policy (CSP) through an HTTP response header that controls which external resources (such as scripts, styles, images, and API calls) the browser is allowed to load. By default, CSP is disabled in APIM, which often leads security scans to report a violation for a missing or weak CSP configuration. When CSP is enabled with only the default-src directive, it acts as a fallback for all resource types. This can unintentionally block essential portal resources—such as authentication redirects, API test console calls, and Azure-hosted scripts—causing the Developer Portal to malfunction. Due to limited official documentation, enabling CSP without a staged approach can result in breaking existing portal functionality instead of resolving the security finding.
Refer below points to resolve this issue or this is the workaround:
Enable CSP in Report-Only mode first Enable Content Security Policy in Report-Only mode so that violations are logged in the browser developer console without blocking any resources. This allows you to safely identify which resources the Developer Portal depends on before enforcing CSP.
Review CSP violation logs to identify required sources Use the browser’s developer tools (F12) to review CSP warnings. These messages clearly indicate which directive (for example, script-src, connect-src, or style-src) and which domain is being blocked. This helps determine exactly which sources must be allowed.
Avoid relying only on default-src Do not use a restrictive default-src alone (such as 'self'). Instead, define explicit directives like script-src, style-src, connect-src, img-src, and frame-src. This prevents unintended blocking of portal features such as OAuth sign-in, API testing, and embedded documentation.
Gradually enforce CSP after validation Once all required domains are identified and added, switch CSP from Report-Only mode to Enforced mode. This approach satisfies security scan requirements while ensuring that existing Developer Portal functionality remains unaffected.