# How do I diagnose and fix a Content Security Policy error in a Power Apps code app?

Exam: AB-400 — Power Platform Developer Associate
Knowledge domain: Extend the user experience (25–30%)
Updated: 2026-11-25T06:47:19.263011+00:00
HTML: https://learningpathx.com/faq/AB-400/ab400-power-apps-code-app-csp-blocked-resource.html

## Also asked as

- What should an administrator check when CSP blocks a code app script or telemetry request?
- How do I identify the directive responsible for a blocked code app resource?

Use the browser Console and Network panel to identify the affected resource and directive, and confirm that CSP actually blocked the request. Reporting can be enabled independently of enforcement. A violation report can therefore describe a request that was allowed during a report-only evaluation.

Code app CSP applies across the environment and changes require an environment administrator. Review the resource with its owner. For example, `script-src` governs a JavaScript load and `connect-src` governs a telemetry connection. Capture the effective policy before editing. A custom source normally extends the default list and replaces a default of `'none'`. The documented update helper replaces the full directive collection, so preserve entries outside the intended change. A blank custom source list can disable a directive.

In isolated test, remove an unneeded dependency or add only the approved source to the relevant directive. Allow propagation and reproduce with enforcement enabled. Check the affected interaction and a representative app sharing the environment. Keep the original settings available for recovery and verify the effective policy after any restoration.

[Configure Content Security Policy for code apps](https://learn.microsoft.com/en-us/power-apps/developer/code-apps/how-to/content-security-policy)

Source: [AB-400: Deploying and Troubleshooting Power Apps Code Apps](https://learningpathx.com/news/ab-400-deploying-and-troubleshooting-power-apps-code-apps.html)
