I still remember the first time I deployed a Power Platform solution from Development to Production. Everything broke! My flows were failing because they were still trying to use my Dev connections and URLs in the Production environment. That fiasco taught me that managing connection references and environment variables across environments isn’t just a nice-to-have – it’s essential.

If you build solutions in Microsoft Power Platform across multiple environments (Dev, Test, Prod), you need a clear strategy for connection references and environment variables. Done right, it makes deployments smoother and maintenance easier. In this post, I’ll outline the best practices I’ve learned (often the hard way) to keep these components organized.

Connection References: One Per Service Type

When it comes to connection references, my rule of thumb is one connection reference per service (connector) per environment. In other words, don’t create separate connection references for the same service in every solution. Instead, reuse a single reference for, say, SharePoint in the Dev environment, one for SharePoint in Test, and one in Prod.

Benefits of Centralizing Connection References

Using one connection reference per service per environment comes with several benefits:

  1. Simplified Management – With one reference per service, there’s only one place to update credentials or settings.
  2. Reduced Duplication – You avoid having multiple connection references all pointing to the same service.
  3. Streamlined Updates – When a password or API key changes, you only have to update it in one reference.
  4. Centralized Control – A single, central reference for each service can be managed by administrators.
  5. Enhanced Governance – It’s much easier to see what connections exist in your environment.

Implementation Strategy

Here’s how I typically set up the one-per-service approach:

  1. Core Connections Solution – Create a dedicated solution (e.g. “Core Connections”) in your Dev environment that contains all the connection references your apps and flows will use.
  2. Reuse in Other Solutions – In each of your other solutions, reference the connection references from the core solution instead of creating new ones.
  3. Establish Dependencies – Make the core connections solution a dependency for your other solutions.

This approach fits nicely with the typical ALM workflow: develop and test in Dev with unmanaged solutions, then deploy as managed solutions to Test and Production.

Multi-Developer Environments: Special Considerations

If you have multiple developers working in the same environment, a strictly centralized approach can get tricky:

  1. Connection Reference Conflicts – If everyone uses the same connection reference in Dev but with their own credentials, they’ll keep overwriting each other’s settings.
  2. Solution-Specific References in Dev – To avoid conflicts, consider giving each solution (or each developer) their own connection reference during development (e.g., SharePoint_SolutionA and SharePoint_SolutionB).
  3. Pre-Deployment Cleanup – Before moving to Test/Prod, ensure none of the connection references are using personal accounts and consider consolidating duplicate references.

Here’s a quick guide for deciding how to manage connection references:

Scenario Recommended Approach
Single developer environment Centralized (one connection ref per service).
Multiple developers, sequential Centralized (coordinate changes to shared reference).
Multiple developers, simultaneous Solution-specific references in Dev; consolidate before Prod.
Production environment Always centralized (no personal connections; use service accounts).

Environment Variables: Shared vs. Solution-Specific

Connection references cover how your apps and flows connect to services. Environment variables cover which specific resources or settings they point to.

Imagine deploying a flow and realizing it’s still pointing at a SharePoint list on your Dev site—oops! Environment variables help prevent that by externalizing those environment-specific values.

Types of Environment Variables

In my experience, environment variables usually fall into two categories:

  • Shared Variables – Used across multiple solutions. For example, a SharePoint site URL that many apps/flows might need.
  • Solution-Specific Variables – Used only within a particular solution. These hold values that only matter to one app or flow.

Best Practices for SharePoint Site and List Variables

For Power Platform solutions that integrate with SharePoint, I recommend this approach:

  1. Core SharePoint Connection & Common Variables – Use a core solution to hold the single SharePoint connection reference and environment variables for commonly used SharePoint sites and lists. For example, include an environment variable for the URL of your main SharePoint site, and variables for any SharePoint list used by multiple solutions.
  2. Solution-Specific List Variables – If a SharePoint list is used by only one solution, keep that environment variable within that solution. There’s no need to clutter the core solution with a variable that only one solution uses.
  3. Consistent Naming Conventions – Establish a naming pattern for your environment variables. For example, prefix SharePoint site variables with env_SPSite_... and SharePoint list variables with env_SPList_....
  4. Plan for Deployment – Make sure you set the correct values for these variables in each environment. Document these values or use deployment scripts/automation to populate the right values when importing solutions.

Benefits of This Approach

Adopting these best practices pays off in several ways:

  1. Reduced Maintenance Overhead – Less duplication means fewer things to update when changes occur.
  2. Improved Deployment Reliability – A consistent structure makes solution imports more predictable.
  3. Better Governance – You get clearer visibility into what connections and configuration variables exist.
  4. Enhanced Collaboration – Team members can more easily understand the overall architecture.
  5. Streamlined ALM – You’ve separated what needs to change per environment from the solution logic itself.

Practical Example

Let’s walk through a simple example. Imagine your organization has multiple Power Platform solutions – an HR solution and a Finance solution – and both interact with SharePoint data.

  • Core Components Solution – Create a Core Components solution to hold shared assets:

    • SharePoint Connection Reference: the single SharePoint connection reference for that environment.
    • Environment Variables for Main SharePoint Site: e.g., the URL of the main SharePoint site (env_SPSite_MainSite).
    • Environment Variables for Common Lists: e.g., a list of Employees that multiple solutions might use (env_SPList_Employees).
  • HR Solution – The HR solution references the SharePoint connection from the Core Components solution. During development, if multiple developers are working on it, it might temporarily use its own SharePoint connection reference (e.g., SharePoint_HRDev), but before deployment to Prod, the flows are reconfigured to use the single core connection. The HR solution contains environment variables for any SharePoint lists that are only used in the HR app (e.g., env_SPList_OnboardingTasks).

  • Finance Solution – Similarly, the Finance solution uses the core SharePoint connection in Production. The Finance solution includes its own environment variables for SharePoint lists that only the Finance app/flows use (e.g., env_SPList_ExpenseReports).

In this setup, both department solutions share the same SharePoint connection reference in the Test/Prod environments and use the common site URL variable. They each maintain their solution-specific list variables as needed.

Conclusion

By centralizing connection references and properly organizing environment variables, you can create Power Platform solutions that are much easier to maintain and deploy. I’ve found this approach especially valuable when going from a development environment to Test and Production environments.

For SharePoint-heavy implementations, keeping a single SharePoint connection reference while dividing your environment variables into common versus solution-specific sets provides an optimal balance. And in multi-developer scenarios, using solution-specific connection references during development (and then consolidating them before release) can prevent many headaches.

Key Takeaways:

  • Use one connection reference per service per environment. Don’t duplicate the same connector across solutions.
  • In multi-developer environments, give each solution its own connection reference to avoid collisions.
  • Externalize environment-specific values using environment variables instead of hard-coding them.
  • Centralize common variables in a core solution for values used by multiple solutions.
  • Name your connections and variables consistently so their purpose is clear.
  • Plan your deployments for these components to ensure nothing is missed when promoting solutions.

In the long run, adopting these best practices will save you time, reduce errors, and result in a more robust Power Platform implementation across all your environments. (I only wish I had learned them sooner!)