·3 min read·Rishi

Managing Environment Variables Across Dev, Test, and Prod in Power Platform

power-automatepowerappstutorial
Managing Environment Variables Across Dev, Test, and Prod in Power Platform

Hardcoding URLs, connection strings, and configuration values directly in your Power Automate flows guarantees they will break when you move from dev to test to production. Here is how to manage environment-specific configuration properly in 2026.

Environment Variables in Solutions

Power Platform environment variables are the native solution for this problem. They live inside solutions, travel with your deployments, and can have different values per environment.

Creating an Environment Variable

  1. Open your solution in make.powerapps.com
  2. Click New > More > Environment Variable
  3. Set the Display name, Type (text, number, JSON, data source, secret), and Default value

Use the default value for your dev environment. When importing the solution into test or prod, you will be prompted to set environment-specific values.

Using in Power Automate

Reference environment variables in expressions:

@parameters('variable_name')

Or use them directly from the dynamic content panel — search for the variable name after adding it to your solution.

Secret Type Variables

For API keys and credentials, use the Secret type. These store values in Azure Key Vault:

  1. Create a Key Vault in Azure
  2. Add the secret to Key Vault
  3. Create an environment variable of type Secret
  4. Link it to the Key Vault reference

The flow accesses the secret at runtime without exposing it in the flow definition — critical for security compliance.

Connection References

Connections (to Dataverse, SharePoint, Outlook, etc.) are environment-specific by nature. Use connection references in your solutions:

  1. Add a connection reference to your solution
  2. Use that reference in all flow actions instead of direct connections
  3. When importing to a new environment, map the reference to a local connection

This prevents the classic "flow imported but all actions show connection errors" problem.

Deployment Pipeline Configuration

With Power Platform pipelines (now generally available):

  1. Define your environments in the pipeline configuration
  2. Set environment variable values per stage
  3. Map connection references per stage
  4. Deploy with a single click — values are swapped automatically

Example Pipeline Structure

Dev (source)
  → Test (environment variables: test URLs, test connections)
  → Production (environment variables: prod URLs, prod connections)

What Not to Do

  • Don't use Compose actions with hardcoded values as "variables"
  • Don't maintain separate copies of the same flow per environment
  • Don't store secrets in plain text environment variables
  • Don't skip connection references — they save hours of post-deployment fixing

Key Takeaway

Use environment variables for configuration, connection references for connectors, and Power Platform pipelines for deployment. This combination gives you clean, repeatable ALM without manual post-deployment patching.

Comments

No comments yet. Be the first!