Study FAQ
How do I use environment variables for a code app's data source?
Also asked as 2
- 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?
Answer
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:
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.
Full explanation
AB-400: Building Code Apps with Dataverse and Automation
Study guide · AB-400
Read the full explanation