Blog
Using Environment Variables with Cloud Flows
Do you leverage data from multiple applications or services? If you haven’t already found a way to integrate the data between them, you should check out Microsoft Cloud Flows, which are part of Power Automate and part of the overall Power Platform.
What are Cloud Flows?
Cloud Flows allow power users to build workflows that integrate a diverse set of apps and services, including Dynamics 365, SharePoint, SQL Server, Act!, Twitter and many more! Each workflow can have one trigger, such as a timer or an incoming email or tweet, and one or many actions, such as creating a Lead in your application of choice and sending a text message to a user. Most of it requires little to no code, but a Developer can help extend the functionality.
Using Environment Variables with Cloud Flows
Within the Power Platform, there are many pre-built connectors that you can leverage to consume data and/or create data, such as the Excel, SharePoint, Azure Cosmos DB connectors. These connectors typically have you input specific values that are unique to the environment that you are pointed to. For example, within the SharePoint connector, you must specify the path of the site that you are communicating with. If you are only working with one environment, you can certainly hard code those values within the connector’s actions. However, this can become a challenge when you must import your cloud flows to multiple environments because the incorrect value within the connector’s actions could get deployed to the wrong environment. You can work around this by using Environment Variables
What are Environment Variables?
Environment Variables are records that can hold unique connector values for each of your unique Power Platform environments. These can be stored in your Development solution and then imported to each of your QA and Production environments. They are comprised of a Display Name, Name, Data Type, Default Value, Current Value (optional). The available data types as of this writing are Decimal number, Text, JSON, Two options, Data source and Key Vault Secret.
Creating Environment Variables in your Development environment
Creating Environment Variables can be done from within your Development solution. When creating them, ensure that the Default Value contains your Development value and leave the Current Value blank. The Current Value field will be filled in manually once these are deployed to your QA and Production orgs. As the MS warning explains, filling in the Current Value in Dev will otherwise overwrite your QA and Production values during future deployments.
Using Environment Variables in your cloud flow
Using an Environment Variable in a cloud flow is easy. This example shows how to use it with the SharePoint connector:
Deploying Environment Variables to your QA and Production environments
Before deploying your solution to QA and Production, ensure that the Current Value is blank. Once you export the solution and import into QA and Production, you only need to fill in the Current Value for each Environment Variable once in QA and Production. Any subsequent deployments will NOT overwrite the Current Value in those organizations as long as the Current Value remains blank in your Dev solution.
One last thing to consider is that if the flows run in the context of the end user, ensure that they have read privileges to the Environment Variables or the flows may fail.
Contact Beringer Today!
We love to implement Microsoft Dynamics 365 and Power Platform solutions here at Beringer. We’ve been working with Microsoft Dynamics since its inception, and we’re always finding innovative ways to implement the latest tools and help automate business processes.
Beringer Technology Group, a leading Microsoft Gold Certified Partner specializing in Microsoft Dynamics 365 and CRM for Distribution also provides expert Managed IT Services, Backup and Disaster Recovery, Cloud Based Computing, Email Security Implementation and Training, Unified Communication Solutions, and Cybersecurity Risk Assessment.