Power Platform: update Current Value of an Environment Variable in a Managed Solution

Why?

In my last post Power Platform: Current Value of an Environment Variable in a Solution, I tried to explain a product defect in Environment Variables. Apparently when you try updating the Current Value of an Environment Variable in a (previously imported) Managed Solution, it may seem impossible because of strange errors, notifications and greyed out options.

What?

This post will give you the two best options on how to update an Environment Variable in a Managed Solution, if you did not leave the Current Value of an Environment Variable in an Unmanaged Solution intact before exporting it to a Managed Solution.

How?

For all background info see the post mentioned above and the Microsoft Community post I started here: Solved: Re: Updating Environment Variables in Managed Solu… – Power Platform Community (microsoft.com).

1) The first option is the fastest one using the modern Power Apps Maker Portal. You just visit the Entities / Tables and look for the Environment Variable Value table:

When you select the Data tab, you will see the current Environment Variable Values presented as records in your Dataverse:

When you try to edit the record, you will get an error notification about Read privilege violations like:

❌ “You do not have permission to access these records. Contact your Microsoft Dynamics 365 administrator for help.” ❌

The magic of this workaround is in the URL. Replace the part:

?cmdbar=true&forceUCI=1

with

?cmdbar=true&forceClassic=1

and the Classic Interface of Dynamics will give you the option to edit and save:

Notice the almost invisible save icon at the bottom right πŸ€“

2) The second option is using the extracted Managed Solution Files. If desired, I can add screenshots. However the people wanting to explore this workaround should already be familiair with the concept of how the Power Platform Solutions consist of a zipped combination of files.

Unzip the Managed Solution (needs to be a higher version number of the already existing Managed Solution imported).
Look for the environment_variable_values.jsonΒ file amoung the unzipped files.
Find the Environment Variable Value record in the file by searching for the GUID of the record.
Change the existing value of the variable to the desired value.
Rezip the files again and import the new zipped file just like any other updated Managed Solution. πŸ’ͺπŸ‘

4 thoughts on “Power Platform: update Current Value of an Environment Variable in a Managed Solution

  1. This is still not solved and thrid way to update environemtn varaible in case of managed solution is to look open default solution and then look for your variable. From this scrren, you can update its value.

    My chalelnge further is, even if datasource environemtn variable values are updated, powerapp deosnt recognize these values adn keeps referring my source environemtn from where soluton was imported.

  2. I think the documentation is vague, but this is what I did after doing some research.

    There is a specific way to “Unload” a value from an Environment variable in the current solution before Exporting it out.

    There is a menu item represented by ellipses next to the “Current Value” attribute of an environment variable. We have to click that and select “Remove from this solution” option.

    Once you do that I think that it removes the value from the “Environment Variable Value” table which causes the solution to prompt for new values when importing the solution into a new Environment.

    I followed this process and now I can see that I am prompted for new values when importing the solution into my Managed Solution Environment.

    1. Hi Andy,
      It has been a few months since I experienced this. Chances are that the Product Team at Microsoft has solved (a big part) of this buggy experience.
      Thank you for sharing! πŸ‘

Leave a comment