Often there is a need to use some kind of configuration for your customizations to work across environments in Power Platform or for storing the 3rd party URLs like SharePoint, other API services etc…previously there were ways where you can store your config but now with this helps in efficient way of interacting with your configuration across environments.
One environment variable can be used across many different solution components – whether they’re the same type of component or different ex. Power Apps and Flow can use the same variable in the environment. Environment variables store the parameter keys and values, which then serve as input to various other application objects.
Additionally, if you need to retire a data source in production environments, you can simply update the environment variable values with information for the new data source. The apps and flows don’t require modification and will start using the new data source.
The environment variables can be unpacked and stored in source control. You may also store different environment variables values files for the separate configuration needed in different environments. Solution Packager can then accept the file corresponding to the environment the solution will be imported to. Thanks @Rezza Dorani for the video…
The following environment variables are available as on today…
- Environment variables are supported in custom connectors.
- Provide new parameter values while importing solutions to other environments.
- Supported by Solution Packager and DevOps tools enable continuous integration and continuous delivery (CI/CD).
- Its very easy to maintain datasources in Environment variables.
- Its ideal for passing any parameters to bound or unbound actions from Power Automate.
Neverthless there were few limitions:
- When environment variable values are changed directly within an environment instead of through an ALM operation like solution import, flows will continue using the previous value until the flow is either saved or turned off and turned on again.
- If the environment value is changed, it may take up to an hour to fully publish updated environment variables.
- If you made the same mistake as I did and imported a Managed Solution without a Current Value, added a Current Value for the first time and cannot edit the new Current Value anymore.
- It looks like a potential risk.
Hope this post helped in some way…please let me know if you have any questions….