Power Automate

Use Different SharePoint Sites for each environment (Dev, Test, Prod)

Table of Contents

When developing solutions using Microsoft Power Platform, we usually work with different environments: development, testing, and production. If we use SharePoint and if we don’t do it the right way, it can get tricky to have different SharePoint sites or lists for each environment because we might end up having to make a lot of manual changes for each of the different environments.

Luckily, the Power Platform has some out-of-the-box options to handle this process more easily. This article shows how to use different SharePoint Sites for each environment (Dev, Test, Prod).

Create SharePoint sites and lists

Make sure you go through the process of creating the two or three different SharePoint sites that will be needed, depending on the number of environments where the solution will be deployed in. When doing this, make sure the columns from lists and libraries have the very same names across all sites. The “Add from existing” option will be useful to ensure this requirement. It’s usually a good idea to wait until you have a stable solution in Dev to create all the other SharePoint sites and lists.

Is your business ready for automation?

Automate processes with Microsoft Power Platform.

Create SharePoint sites Column

Create Environment variables for data sources

Option 1: Create it from Power Apps design studio

Create a Canvas App from the solutions management page (or if it’s already created, add the app to the solution) and then enable this option in the app settings:

Power Apps Design Studio Column

Then, add the SharePoint list as a data source following the regular connection steps. And that’s it – all the SharePoint lists you add to the app will be created as an environment variable and they will be available in the same solution where the app is created and they will be usable from Power Automate too.

Option 2: Create them from the solution management page

Step 1. Add environment variable for the site

Open the solutions section in the Power Apps or Power Automate portal, and open the solution where the SharePoint connections will be used in. Then go to New > More > Environment variable

Objects Column

Step 2. Create Site connection

In the right pane, assign a name to the variable, select Data source and SharePoint and then select the SharePoint site:

Environment Variable Column

Step 3. Add environment variable for the list

Follow the same steps to create the variable: New > More > Environment variable

Add environment variable Column

Step 4. Add connection for the List or Library

Make sure to select the SharePoint site variable created in step #2 and after selection, click on “Add current Value” and the List selection dropdown will be enabled and will allow you to pick an option from the list. Then just hit on save.

SharePoint Site Variable Column

Repeat these steps for as many sites and lists or libraries as required.

Use the environment variable in Power Automate

Make sure that all the flows where you will use these SharePoint dynamic connections are created inside the same solution where the variable was created in.

To use the variables in Power Automate, just add a SharePoint action such as Create Item or Create File and in the “Dynamic content” tab you will see some brown options – those are all the environment variables created in the environment – just look for the SharePoint connection environment variable and click on it in both the SharePoint site and SharePoint Library or list.

Site Address Column

Move solution across environments

When the solution is exported to be deployed in a new environment, the solution wizard will prompt you to select which SharePoint site, List and/or Library belongs to the current environment where the solution is being imported to:

SharePoint Site List Column

Conclusion

Implementing separate SharePoint sites for each environment—Development, Testing, and Production—in the Power Platform is considered the best practice and by separating these environments, you can test things without worrying about having test, dev and prod data mixed. It’s a simple step that makes a big difference in keeping everything in order. 

Are you ready to discover the joy of automation?

Whether you have a project in mind or just want to know how we can help, we’re happy to have a conversation

Contact us if you would like to have a conversation about how we can help you in deploying your Power Platform solutions!

Author
Power Platform Consultant | Business Process Automation Expert
Microsoft Certified Power Platform Consultant and Solution Architect with 4+ years of experience leveraging Power Platform, Microsoft 365, and Azure to continuously discover automation opportunities and re-imagine processes.