A simple workaround for Environment Variable update limitation with Managed Solutions.
I recently encountered a (unknown-to-me) limitation while working in a multi-tier environment using Microsoft Power Platform Solutions. Specifically, I encountered an issue with a Managed Solution and the environment variables defined in it, leading me to the discovery of a simple workaround I wanted to share.
The Problem, My Problem
When using Managed Solutions, you can only update environment variables during import. After that, you’re unable to update them. This became a problem during the deployment of a solution that I was working on that has multiple environments (e.g., Development, Test, and Production).
In my case, I needed to store the current App URL in an environment, in the environment variable because I would later use that value in a Flow for other purposes. However, the App URL is not available until after the solution is imported. Once imported, I realized I couldn’t update the environment variable and confirmed that it is by design.
The Workaround
After a couple of minutes of mental anguish, I found a solution that worked pretty well. Here’s how I resolved this limitation (by design):
- Import with a Placeholder: I started by importing the solution with a placeholder value for the App URL, allowing me to complete the import process.
- Capture the App URL: After the import, I navigated to the app and grabbed the actual App URL.
- Reimport the Managed Solution: I imported the same solution once again. Power Platform recognized the existing solution and didn’t change the App URL, but importantly, at the final step of the reimport, it let me update the environment variables again.
- Update the Environment Variable: This time, I replaced the placeholder with the correct App URL during the reimport. Voila!
This simple double-import process allowed me to bypass the limitation and continue with the deployment across my multi-tier environment, using the actual value from the App.