Skip to main content

Notifications

Power Apps - Power Apps Governance and Administ...
Suggested answer

Reconfigure all environment variables when importing a managed solution inside PROD environment.

(0) ShareShare
ReportReport
Posted on by 1,374
I have 2 environments inside Power Platform:-
 
1) Dev
 
2) PROD
 
Where inside the Dev environment i set all the environment variables as follow with the "Export value" checkbox turned off:-
 

 
 
 
I usually do the following which was working well (last time i did an export/import was 3 months ago):-
 
1) Export the solution from Dev as managed solution
 
2) Import the solution to PROD using the Update option, as follow:-
 
where things were straightforward, as all the environments variables inside the Dev, have the "Export" checkbox unchecked, so the environment variables inside the imported solution should AUTOMATICALLY use the setting inside PROD when doing the Import inside the PROD, without the need to reconfigure them.
 
But starting from last week, when i do the Import inside the PROD, all the environment variables referencing SharePoint list will appear inside the Import wizard and they all have the GUID of the list inside DEV, so i have to manually reconfigure them , where i have around 80 SharePoint lists..
Here is how the Import wizard will look like, first i got that a SharePoint connection need to be reconfigured, although i did not change it on Dev or on PROD:-
 
 
After that when i click on "Next", i were asked to reconfigure all the environment variables representing SharePoint lists and libraries, as follow:-
 
 
any advice what is going on? why i need to reconfigure the environment variables ?
 
And I noted that even when i select all the lists representing the PROD environment variables and the import got completed, the modified dates for those environment variables will be 2 month ago, so seems they did not get affected by the selection ,, so is this a bug inside the import wizard and can this be solved?
 
 
Thanks
  • johnjohnPter Profile Picture
    johnjohnPter 1,374 on at
    Reconfigure all environment variables when importing a managed solution inside PROD environment.
     
    Ok but before 2 months i were doing the export + import and everything were working as expected as long as this checkbox on the Dev is unchecked:-
     
     
     
    Noe you want me to remove the Current value + the Default value, then if i do so, i think the solution on Dev will stop working ? am i correct?.. another question, what is the reason that Microsoft introduce the above "Export value".. as its description is saying  if unchecked -as i am doing- the environment variable value should be removed from the exported solution,, but this is not hapening... am i correct?

    Also inside this link which you provided https://learn.microsoft.com/en-us/power-apps/maker/data-platform/EnvironmentVariables this last image:-



    is old and we no longer have the option to remove from solution, we only have the option to remove from environment + the Export checkbox...
  • Suggested answer
    Pstork1 Profile Picture
    Pstork1 64,174 on at
    Reconfigure all environment variables when importing a managed solution inside PROD environment.
    @johnjohnPter Its not a bug. Its a side effect of the way its designed to work.  On the first import there are no values in the target environment (Prod) so it prompts you to enter values whether there are values in the solution or not. On each additional import you need to make sure there are NO values in the Solution being imported or you will overwrite the existing values stored in production because they are stored as an unmanaged layer, not as part of the Managed Solution.  The documentation I linked you to specifies that you should remove ALL values for Environment variables before you Export a Managed Solution. If you don't then the behavior you are experiencing will happen on anything other than the first Import.
     
    The bottom line is that actual default values for any environment variable should never be included when exporting a Managed solution.  And I'm sure you will reference the switch in the setting saying not to export the current value. But that only effects the current value, not the default value. You need to remove both before export. That has always been the "Best Practice" for solutions. It used to be required or you wouldn't be prompted to set values on the first import. That was fixed, but subsequent imports are still a problem.
  • johnjohnPter Profile Picture
    johnjohnPter 1,374 on at
    Reconfigure all environment variables when importing a managed solution inside PROD environment.
    Thanks for the reply, but i am not doing the import for the first time, the environment variables inside the Dev and PROD are already defined, i am on version 23 now. and i am only modifying the power automate and power apps buisness logic  on Dev . But when i export from Dev and import into PROD i am been asked to reconfigure all the environment variables representing SharePoint lists (sites and static values such as string are been preserved based on the PROD setting).. so seems there is a bug in the environment variables which represents sharepoint lists..
  • Suggested answer
    Pstork1 Profile Picture
    Pstork1 64,174 on at
    Reconfigure all environment variables when importing a managed solution inside PROD environment.
    A fix was put in a while back that would prompt for a new value for environment variables IF an existing value wasn't present in the new environment. That's why it prompts you when you do the original import. But after that you should always remove the values of environment variables from the solution before you export the managed solution. This keeps the values from overwriting existing values when you do the import. The values will still be in the dev environment even if you remove them from the solution because they are actually stored in a Dataverse table. 
     
    This happens because environment variables create an unmanaged layer in the default solution for an environment when a managed solution is imported. So when you update the managed solution with a new one the unmanaged values get overwritten if they exist.  Based on the documentation here it has always been and continues to be a Best Practice to remove any values before export/import.  Use environment variables in Power Platform solutions - Power Apps | Microsoft Learn

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #9 Get Recognized…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,867

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,174

Leaderboard

Featured topics