Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Environment variables store values—such as email addresses, connection strings, or URLs—that can be reused across flows and solutions. Environment variables are useful when you need to change values based on the environment (like Development, Test, or Production). They allow you to update values without modifying the flow logic itself.
For example, you might have an environment variable for a SharePoint site URL that's used in multiple flows. If the URL changes, you need to update only the environment variable instead of each individual flow.
This article shows you how to create environment variables, use them in your flows, and deploy them across different environments.
Use cases for environment variables
Environment variables can be used in various scenarios. Here are some common use cases:
| Use case | Environment variable | Example |
|---|---|---|
| API integration | API_Base_URL | Used in an HTTP action to call https://dev.api.com or https://prod.api.com |
| Email notifications | SupportEmail | Used in a Send an email action to route messages to the correct team |
| SharePoint | SP_Site_URL | Used in SharePoint actions to dynamically set the site URL |
Create environment variables
Create environment variables to help you avoid hardcoding values and make your flows more portable and easier to maintain. You create them within a solution and then reference them in your cloud flows.
Sign in to Power Automate.
In the Environments list in the title bar, select the environment where you want to create the variable.
On the navigation pane to the left, select Solutions.
Open an existing solution or create a new one.
- To open an existing solution, select it from the list.
- To create a new solution, select + New solution, fill in the required fields, and then select Create. Learn more in Create a solution-aware cloud flow.
Select + New > More > Environment variable.
Fill in the fields:
- Display name: A friendly name for the variable.
- Name: The unique name used in code.
- (Optional) Description: A brief description of the variable's purpose.
- Data type: Choose from Decimal number, JSON, Text, Yes/No, Data source, and Secret.
- Default value: The value used unless overridden.
- Current value: Optional override for the current environment.
Select Save.
Use environment variables in cloud flows
Once created, you can reference environment variables in your cloud flows in a solution.
Sign in to Power Automate.
In the Environments list in the title bar, select the environment where your variable is stored.
On the navigation pane to the left, select Solutions.
Open an existing solution or create a new one.
- To open an existing solution, select it from the list.
- To create a new solution, select + New solution, fill in the required fields, and then select Create. Learn more in Create a solution-aware cloud flow.
In your solution, create or open a cloud flow.
Select or add an action that will use the environment variable.
Select field where you want to insert the environment variable, and then select the lightning bolt icon to show the dynamic content list.
If the icon isn't visible, select the gear icon, and then select Use dynamic content.
Search for and select your environment variable. It appears in the field as a dynamic value.
The following screenshot shows the
Contactsenvironment variable in the Dynamic content list. Select it to copy it to the cloud flow action:
Save and test your flow to ensure the environment variable is being used correctly.
Deploy across environments
To use an environment variable in a different environment, you need to export your solution. When you import the solution into another environment, the environment variable is included.
- Learn how to export a solution.
- Learn how to import a solution.
When you import the solution, you can set the environment variable's value for that environment. This allows you to customize the variable for different environments without changing the flow logic.