Overview
In this article, we will learn how we can consume environment variables directly to Power Apps Canvas App. Currently, there are two ways to consume Environment variables in Canvas App.
- Using Dataverse Connector (Requires Premium License)
- Using Power Automate (Using Standard License – No additional License)
We will check both options in detail.
Consume Environment Variable in Power Apps Using Dataverse Connector (Premium License Required)
Connect the following Dataverse tables.
We are going to consume the following environment variable.
Add the following formula to get the value of an environmental variable.
LookUp(
'Environment Variable Values',
'Environment Variable Definition'.'Schema Name' = "crb45_VideoURL",
Value
)
Consume Environment Variable using Power Automate (No License Required)
- Create Power Automate flow with PowerApps Trigger.
- Add an action “Respond to a PowerApp or flow”.
- Add the Variable you want to return to the app.
- Go to Power Apps
- Go to Action, select Power Automate and add flow.
- Open the OnStart Event of the App.
Add the following line of code
Set(varEnvVariables,GetEnviVariables.Run().url)
Add one label and print the value of the environment variable.
Conclusion
This is how we can consume environment variables in PowerApps. Isn’t it cool?