Showing results for 
Search instead for 
Did you mean: 

Get environment ID within Flow or app

Can we have a way to determine the environment ID that a flow or app is currently running in?


I have several flows and apps that I develop in a staging environment, test using test data, and then promote to a production environment, which run on production data. It would be nice to be able to determine which environment the flow/app is running in, and do branching conditions based on that. For example:


* My canvas app allows people to send emails to another person. In staging, I want those emails to always go to a hard-coded email address (the person who is testing). In production, I want the emails to go to the actual recipient.

* Same as above, but it is in a flow.

* One of my flows creates a record and assigns it to a specific owner. The owner exists in the production environment, but not in the staging environment, because he isn't part of the group that tests things. I have to change which user the record gets assigned to based on which environment the flow is running in.


Currently I'm solving this by exporting the flow/app from staging, importing it into prod, and going in to make all of the manual tweaks to the logic. This process is highly prone to errors, because I may forget to do one of the tweaks, and if anybody else makes changes, we might now know what tweaks need to be made in each other's code. This would be much easier with conditional logic based on the environment ID.

Status: Under Review
Advocate IV

I think environment variables solve this for me:


Thanks, Microsoft!

Power Apps
Status changed to: Under Review
Kudo Kingpin

As useful as solution environment variables are, it almost seems like overkill for something so simple. Figuring out which environment your app is in could be accomplished with something like App.CurrentEnvironment.

I don't even use solutions for all my apps, since sometimes the export app option is plenty. As far as I've read, if I don't make my app inside a solution, I don't even have to option to use these environment level variables. 

Post Patron



I agree, I this would be useful check to display on any  published Power Apps . Indeed I am now looking at an issue whereby  deeplink to a Power App published in Production is now referencing the Power App sitting in production , not great🙄.

Advocate III

Actual State of Review. We need Environment ID in Power Automate Management Connections