Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Outlook
    • Planner
    • Power Apps
    • SharePoint
    • Teams
  • Triggers
  • Ready to use solutions
    • Approval Process Solution
    • Task Delegation App
    • The Ultimate Power Automate expressions cheat sheet
    • Power Automate HTTP requests to SharePoint cheat sheet
    • Power Automate HTTP requests to Graph API cheat sheet
  • ABOUT ME
  • Get help with your flow
  • POWER PLATFORM SERVICES
Menu

Fast replace of connections with env. variables (Power Automate)

Posted on April 14, 2024April 13, 2024 by Tom

“I have an old Power Automate flow with fixed connections, what’s the fastest way to replace all of them with env. variables?”


As already mentioned in previous articles, when you build a flow you should build it as a Solution. But it’s probably not something you do from the beginning. When you start with Power Automate, you probably start by building simple flows. You go to the Power Automate portal and start building, not even knowing about something like a Solution. And then comes a day when you learn about Solutions, and you have a ton of flows without them, with fixed connections…

How do you catch up? What’s the fastest way to replace the fixed flow parts with environment variables, to turn them into proper Solutions?

Replace it in the flow JSON

One of the options is going through all the flows and updating the actions manually. While it’s the most straightforward one, it’s also the most time consuming with a high risk of making a mistake.

A much more efficient approach would be to batch replace it directly in the flow code. In the same way as you can reconnect flows to different lists, you can also replace the fixed connections with environment variables.

Since you’re mapping it from fixed connection to env. variables, you’ll need the env. variable identifiers. Create a new flow where you list all the environment variables in a single action.

Copy / paste the action in a code editor, e.g. Visual Studio Code, to see the variables code.

Next, copy the flow you where you want to replace the connections in the same way. In the ideal case it should be the whole flow (as you already have it in a single Scope to handle errors)…

…and paste it in the code editor.

Replace all fixed sites urls and list ids with the environment variables.

Power Automate env variables replace

Copy / paste the adjusted flow definition back into the flow. The fixed connection will be replaced with the environment variables.

Power Automate env variables replace

It might work also in the exported flow

I believe the same approach should work also when you export the flow as a .zip file, similarly to the previous article. Unfortunately, the import seems to be broken at the time of this article so I can’t 100% confirm.

Summary

Even if you started your automation journey without any knowledge about solutions, it’s still not too late to fix it. Since you can access the code of the Power Automate flows, you can quite easily batch replace the fixed connections with env. variables.

Export/copy the flow, paste it in the text editor, and replace all fixed url / list id occurrences with environment variables. Put the flow back in the editor and voila, the flow is using environment variables and is ready to be part of a solution.


πŸš€ Master Power Automate

Join 2,100+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

Leave a Reply Cancel reply

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

πŸš€ Master Power Automate

Join 2,100+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

Still exchanging emails to get things approved?

Get the Approval Process solution to skip the hard part and deploy an automated, fully functional approval solution on a SharePoint list in minutes! And then the next one, and the next one...

Approval Template Preview ✨ Learn more ✨

Are your approvals stuck due to unavailable approvers?

Keep your approvals running with the Approval task delegation app! Reassign any existing approval task to another user with a single click - no more waiting for absent approvers!

Power Automate approval task delegation ✨ Learn more ✨

Turn ideas into flows with ease!

Grab the complete Power Automate Cheat Sheet Bundleβ€”everything you need to master expressions, SharePoint HTTP calls, and Graph API in Power Automate.

Cheat Sheet Bundle Preview ✨ Get the Cheat Sheets

Didn't find what you were looking for?
Need to adjust a solution to fit your needs?
Or would you just like to get an assistance from somebody with thousands of hours of experience with Power Automate?

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2025 Let's POWER Automate | Theme by SuperbThemes