Environment variables

Environment variables in Dataverse allow you to store the connection reference or keys needed to be used inside the environment. They are more like a global variable that can be accessed within the Power Platform Environment. We can use this to store the values and use it for Power Platform Customizations.

Environment Variables

We can use the environment variables in Canvas Apps, Model Driven Apps, and Power Automate. These environment variables help avoid the hardcode values for configuration data that must be changed during the ALM operations. It allows you to modify the values while moving the solution to another environment.

From the Dataverse perspective, the Environment Variable has two tables: Environment Variable Definition and Environment Variable Values. The Environment Variable Definition table holds the definition, data type, name, and sometimes default values(if it has). The environment variable value table has the current values used inside the current environment. Environment Variable Definition has a 1:N relationship with the Environment Variable Value table.

Environment Variables_image1

Features of Environment Variables

Default value

Current Value

Create a new Environment Variable

Use Environment Variable in Power Automate Flow

ALM of Environment Variables

The environment variables from the solution can be exported and imported across environments. It is still editable if we export and import as unmanaged solutions. But in real-time scenarios, unmanaged solutions are not much preferred to get imported to the environment in terms of ALM.

Environment Variables_image10

To tackle this, we have to remove(not delete) the current value for all the environment variables and export the solution as managed. While importing the solution to the target environment, a prompt opens up and asks for the values for that environment variable.

Environment Variables_image11

Enter the values to the fields in the prompt and click import to import the solution. After importing, the flows will work on the new values entered in the prompt.

Limitations

If the flows use the environment variable values, but the value gets changed from the solution. But the flow still uses the previous value. The flow must be turned on and off to catch up with the modified value.

Make use of the most Environment Variables