Different Configuration Settings are required across Environments for Applications and Flows. Microsoft recently introduced the ability to transport Configuration Data for Applications using Solutions from one Environment to another.
Traditionally this Configuration Data was stored as record data in custom entities and required tools to migrate like Configuration Migration Utility.
These Tools still serve different purposes, Environment Variables provide a better way to migrate Key-Value pairs in Solutions. As these are Solution Components they can be managed from Source Control together with Other Customizations. Also, Performance is enhanced by overusing Data Import.
The Initial Preview of Environment Variables Feature is targeted at Professional Admins and Developers. Any user can access the feature from Canvas Apps and Flows but they are expected to get much easier as new interfaces are added.
Environment Variables can be managed from the modern solution interface or by using codes. A JSON file is created separately within your Solution Package and you can manage this in Source Control. A Model-Driven App is also there to enable export to excel. Once Environment Variables are created in Common Data Services for Apps, they can be consumed by retrieving data from Environment Variable Value Entities and Environment Variable Definitions. If you need to find a specific value, you can query using the SchemName because it remains the same across environments.
The user will set a Default Value with regard to the Value used in production and also when the Values need to be the same across different Environments. The Definition of this Environment Variable is represented in Customization.xml on your Solution File.
The field is part of the Environment Variable Value Entity and is Optional. This is also known as Override Value or Current Value. This is used by user when he or she wants to override the default value in current environment. This value can be removed if the user doesn’t want it to be used in next environment. But the question is why there are a default value and a vale? This allows users to service definition and the default value away from the current value. This also enables us to extend the functionality so that it can support multiple values based on specific run time contexts.
Users will see a notification when Environment Variables don’t have any Values. This serves as a reminder to set Value or Values so that any Components dependent on these variables do not fails. This also enables ISV’s to ship variables without any values and for the customer to be prompted to input values.
- As of now, Environment Variables cannot be used to store sensitive data like keys and Passwords.
- Caching, Plugins will require a query in order to fetch values.
- Just like Entity Record Data, Canvas Apps and Flows can consume Environment Variables. Microsoft tends to add more actions to Canvas Apps and Flow Designers. This is to simplify the authoring process and to provide better insight into Environment Variables that are in use by a specific App or Flow.
- Currently, Data Types are validated in Modern Solution Interface but not on the Server.