# How do I use environment variables for a code app's data source?

Exam: AB-400 — Power Platform Developer Associate
Knowledge domain: Extend the user experience (25–30%)
Updated: 2026-11-25T06:47:17.312594+00:00
HTML: https://learningpathx.com/faq/AB-400/ab400-code-app-data-source-environment-variables.html

## Also asked as

- How can a Power Apps code app point to the correct SharePoint list after deployment?
- How do I bind a code app's dataset and table to destination environment variables?

For a supported tabular connector, use `@envvar:<schema-name>` in the data source's dataset and table arguments. The references persist in `power.config.json`, and the app resolves them from the target environment.

In an initialized code app, prepare the required connector connection and solution environment variables with their target values. For SharePoint, use the site and list variables with the approved connection:

```shell
pa app add data-source --connector shared_sharepointonline --connection-id "<connection-id>" --dataset "@envvar:<site-schema-name>" --table "@envvar:<list-schema-name>"
```

Replace every placeholder with the corresponding connection ID or exact variable schema name. Inspect the saved configuration, then run a read against a destination-specific synthetic item as the intended user. A valid request can still reach the wrong list if a target value is incorrect. Review the connection identity separately from these target selectors. Use a supported application configuration path for unrelated runtime settings such as telemetry.

[Use environment variables in code app data sources](https://learn.microsoft.com/en-us/power-apps/developer/code-apps/how-to/use-environment-variables)

Source: [AB-400: Building Code Apps with Dataverse and Automation](https://learningpathx.com/news/ab-400-building-code-apps-with-dataverse-and-automation.html)
