Environment variables in Power Apps

This article requires some knowledge about Power Platform environments, solutions and ALM (Application Lifecycle Management).

In the Power Platform, when you develop critical applications, the best practice is to do this using multiple environments.

First you develop in an environment, for example “IT DEV”. When you’re ready to (let the business) test, you move to for example “IT UAT” or “IT TEST”.

As soon as your solution is ready for production, you move it to for example “IT PROD”.

Solutions in development environments like “IT DEV” should always be unmanaged solutions.

Solutions in testing or production environments should always be managed solutions.

When you talk about application lifecycle management (ALM) and (managed) solutions, you talk about environment variables.

In Power Automate, it’s quite easy to use data source environment variables. In Power Apps, it’s a bit more complicated but not difficult.

Using Dataverse, it’s easier because your data structure is part of your solution. SharePoint Online sites are not part of a solution.

Create SharePoint Online data source environment variables in your solution

Go to a solution and create two environment variables.

  • One for your SharePoint Online site
  • One for a SharePoint Online list or document library

Select the environment variable in your Power App

Instead of selecting a static SharePoint Online site, select the environment variable.

Open your Power App and go to “Data”. Click “Add data”.

Add the “SharePoint” connector

Click “Advanced” and select the appropriate environment variable:

In the next step, don’t select a list but click on “Advanced”:

In the “Advanced” table, you can select the data source environment variable for the list:

Click “Connect” when you are done.

You will see that the environment variable shows up instead of a static site:

We have now achieved to use environment variables in Power Apps, ideal for ALM!

Leave a Reply

Your email address will not be published. Required fields are marked *