Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
In this article, you learn about using data source environment variables in canvas apps. You can either use pre-existing data source environment variables, or create data source environment variables automatically when connecting to data.
Use pre-existing data source environment variables
You can reuse environment variables across other apps and even different types of resources like cloud flows. You might want to first create them within your solution and later use them while authoring canvas apps and cloud flows. The following steps use SharePoint Online as an example.
- Follow the steps to manually create an environment variable in a solution.
- Edit or create a canvas app from your solution.
- Add a new data source for SharePoint online.
- Select the Advanced tab. You see a filtered list of available environment variables that you have access to and that match the parameter being set. For example, when you select the SharePoint site, the list contains data source environment variables with Connector as SharePoint and Parameter type as Site. The same is true when selecting SharePoint lists for a given site. If an existing variable doesn't appear, see Limitations and troubleshooting.
- Select the desired environment variable(s), and then select Connect.
Important
- If an environment variable from a different solution is selected, a dependency will exist on the solution containing the environment variable. Therefore, be sure to either:
- Add the environment variable to your current solution prior to exporting.
- Ensure the solution containing the environment variable is imported to the destination environment before your current solution is imported.
Automatically create data source environment variables when connecting to data
This option provides simplicity and ensures environment variables are always used for data sources, such as SharePoint Online. However, some customers prefer to provide their own schema names and therefore should create them from solutions.
Note
Pre-existing canvas apps don't automatically use data source environment variables. Remove the data source from the app and add them back using the above steps to upgrade these apps to use environment variables.
Edit or create a canvas app from your solution.
Select Settings > General and enable the setting to Automatically create environment variables when adding data sources.
Add a New data source for SharePoint online.
Select a SharePoint site, one or more lists, and then Connect.
Note
To prevent creation of duplicate environment variables, you're prompted to use the existing environment variable when duplicates are identified. You can clear the option to use the existing environment variable if creation of a duplicate is desired.
Select Save.
Limitations and troubleshooting
An environment variable can exist in your environment without appearing in the Canvas Studio data source picker. Check the following limitations when you can't find a variable.
Canvas Studio picker limitations
This limitation applies when selecting data source environment variables for supported connectors, including SharePoint and SQL Server. For SQL Server, it applies to connection types that support data source environment variables, such as Microsoft Entra connections.
The Canvas Studio data source picker retrieves only the first page of environment variable definitions and values that match the selected connector and parameter type. It doesn't retrieve subsequent pages. Each Dataverse request returns up to 5,000 matching records, so some variables might not appear in the Advanced tab or its search results. Searching for a missing variable doesn't retrieve it from a later page.
This limitation is for the picker, not a limit of 5,000 environment variables in Dataverse. The relevant count is the number of matching definitions or values for each request, not the total number of variables across all connectors in the environment.
To mitigate this limitation, reuse existing variables and remove obsolete variables after checking their dependencies. Don't delete variables that apps or flows still use. If you can't reduce the number of variables, consider a smaller environment that contains the variables and apps you need. Moving variables into different solutions within the same environment doesn't reduce the number of variables in that environment.
SharePoint-specific configuration checks
In addition to the paging limitation that applies across supported connectors, SharePoint variables must meet these configuration requirements:
- A site variable needs a nonempty Current Value or Default Value that contains the SharePoint site URL. The picker doesn't list site variables with both values empty.
- A list variable's value must match the unique identifier (GUID) of a list returned for the selected site and connection, not the list's display name. Verify that the connection has access to the list and that the variable contains its identifier.
See also
Create canvas app from scratch using Dataverse.
Use environment variables in Power Automate solution cloud flows
Environment variables overview