← All insights

How to use environment variables in Copilot Studio Workflows (hack)

  • Copilot Studio
  • Power Automate
  • Agent Lifecycle Management

In this insight you'll learn how to sneak round the back of the new Copilot Studio 'Workflows' UI to see what lies beneath (hint: it's still Power Automate) and get features that are hidden such as environment variables and more.

Problem

Copilot Studio Workflows, previously known as 'Agent Flows' look really cool but for some reason the new UI doesn't include well-loved and essential features such as environment variables which are essential for good Agent Lifecycle Management (ALM).

Sure, you can create a workaround by creating a Dataverse table called 'Environment Variables' but now you're opening the door to the scary world of post-deployment checklists and making your estate unnecessarily complicated to manage.

Wouldn't it be better if we could use those good old environment variables you've known and loved for years?

Solution

Here you can see the environment variable I've created - varExampleVariable

Power Automate shows varExampleVariable with the default value Sample Value.

As you can see, in the Workflows UI, it isn't possible to find this using dynamic content...

Searching for varExampleVariable in the Workflows dynamic content picker returns no results.

Or expressions - pressing enter simply erases the expression as Workflows can't validate it.

Trying to reference varExampleVariable directly in the Workflows expression editor with parameters().

So let's use my hack to get around the Workflows UI back to Power Automate.

While you're still in Workflows in Copilot Studio, copy the flow GUID from your URL.
We need everything from /flows/{GUID} until the question mark (?)

Copy the /flows/{GUID} portion of the Copilot Studio URL, stopping before the question mark.

Now go to make.powerautomate.com, find the correct environment, paste your /flows/{GUID} onto the end of the URL, press enter and we're in.

Reaction image captioned “We’re in!”

Now that you've hacked the mainframe, you can add environment variables at your liberty.

Select varExampleVariable under Parameters in Power Automate to populate the Variable action’s Value field.

Once you've saved and published, go back to Copilot Studio and click on your workflow.

Don't panic, just because you can't see the environment variable, doesn't mean it's not there, hit play and you'll see that the value pulls through correctly.

In edit mode:

Back in the Copilot Studio editor, the published workflow’s Value field appears empty.

After running the workflow

After running the workflow, the Variable step shows the environment variable’s resolved value, “Sample Value”, in its inputs and outputs.

Et voila - environment variables in Copilot Studio Workflows.

Tell Us What You’re
Trying To Improve.

Whether you are reviewing your IT strategy, preparing for AI adoption or ready to improve a system or process, tell us what you are trying to achieve.We can help clarify the options and agree a practical next step.

We use your email, optional note and the page you submit from to respond. Privacy notice.

info@incrementalvalue.co.uk