Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Solutions and environment variable issues

(1) ShareShare
ReportReport
Posted on by 59

Hi,

 

We have a canvas app that uses SharePoint as the backend that has a dev, staging and production version across three environments. We have a single SharePoint site that each environment saves to and have been using a column to filter out data between each environments app/flows.

 

As part of an upgrade to our app we have created three separate SharePoint sites so each environment will connect to its own. All data sources in the app and all SharePoint connections in our flow point to environment variables. The intention being that when we make a change and push it through our environment's we only have to amend each environments, environment variables and everything is good to go.

 

In the future we plan to add several additional production versions of the app with their own SharePoint sites to cater to different teams.

 

Unfortunately we have been running into several issues, while I have most things worked out, I wouldn't mind some feedback on whether this is the correct approach and am just posting this for other users. We do not want to end up in a situation where each change we make to the app in dev requires extensive modifications per environment to get up and running.

 

Our setup

Environment Variables

One master variable to store that environments related SharePoint site. A variable per SharePoint list that uses the master variable for the site and points to the appropriate list under that site

 

Canvas app

Each data source is uses that master variable, then points to the related list environment variable.

 

Flows

Each SharePoint action uses the master variable, then the appropriate list environment variable, no SharePoint actions are directly pointed to SharePoint.

 

What we expected

When exporting the solution from dev as a managed solution, we import it into staging or prod and that it prompts or allows us to update the environment variables. Once all environment variables point to the site related to that environment. The app and flows work without issue.

 

What's happening

Environment variables

When importing we were not prompted, attempted removing the current value of each environment variable and re-importing with no luck. We could not amend the environment variables within the solution as it was managed. 

Fix -

  • Going to the default solution and amending them there - worked after lots of trial and error, ended up having to delete the solution from staging and re-importing it then modifying the environment variables, but that may be due to all the messing around I was doing. Hopefully modifying the default solution in the future just works.


Canvas app

After amending the environment variables then playing the canvas app only some data sources were pointing to the staging SharePoint site, with others pointing to the dev one, despite them using an environment variable that was pointing to staging.

 

To further test, back in dev I removed all data sources, re-added them via the site environment variable and re-exported then app and imported into staging with the same result.

 

Fix - Once in staging remove all data sources from the app and re-add them via the master site environment variable.

 

Flow

One of our PowerApps triggered flows was erroring, the 1st action that connects to SharePoint using the site environment variable and list environment variable errored, in the error log it was pointing to the dev site and not staging which the environment variable has been set to.

Fix - Started randomly working after about an hour...

 

Categories:
  • Suggested answer
    CU10101926-0 Profile Picture
    2 on at
    Solutions and environment variable issues
    I had the same problem. What solved it was to uncheck the Export value field of all my variable.

  • KarolZareba1 Profile Picture
    16 on at
    Re: Solutions and environment variable issues

    Hi, you can just install the solution in production as managed, after that get the default solution on production, find variables from your installed managed solution and from this place you will be able to change the value of variables.

  • walbertc Profile Picture
    2 on at
    Re: Solutions and environment variable issues

    any update on this? none of the suggestions work for me. Default values don't get carried over to the export even after setting the values manually with production environment variable values. I ended up just using Current values as production values for the export just to get the app to be usable in production, then going back to the development environment to revert back Current values to DEV environment variable values again.

  • Muzammil_069506 Profile Picture
    292 Super User 2025 Season 1 on at
    Re: Solutions and environment variable issues

    @BenAu  im asking the similar even while import im modified the env value it didnt seem to have upated or app is still  pointing to dev site 

  • ReinerKnudsen67 Profile Picture
    on at
    Re: Solutions and environment variable issues

    The worst thing is that you have to edit the app on PROD to fix the connection issues and save the changed app. That put's an unmanaged layer on your solution. 

    I wish MS wouldn't only focu on profit and selling premium licenses but provide proper support for their own solution stack (e.g. SharePoint).

  • KarolZareba1 Profile Picture
    16 on at
    Re: Solutions and environment variable issues

    Exactly it sucks! I never know if after updating the app to PRO it will work properly saving the data in the right place!

  • KarolZareba1 Profile Picture
    16 on at
    Re: Solutions and environment variable issues

    And if I understand correctly, after such an operation, I have to go back to the solution on the DEV and from the soloution to update anew each Sharepoint storage variable, edit the application, remove the connections and add them anew in the reference to the environment variables? 😡

  • Reinerknudsen87 Profile Picture
    59 on at
    Re: Solutions and environment variable issues

    I have exactly the same issues. And yes, I remove the values from the variables before export. Sometimes I get prompted, sometimes I don't. I also noticed that removing and re-adding the variable from/to the app works. But seriously: That can't be the way!

    In addition we face the issue that once we upgrade a solution the referring environment variables in the target environment are suddenly empty and must be set before removing and re-adding them to the app. This feature is rubbish.

  • CH-24102312-0 Profile Picture
    on at
    Re: Solutions and environment variable issues

    I've been looking at this for the past few days and I've noticed that changing the value of the SharePoint environment variable in the recipient environment's Default solution doesn't work immediately, but does 'kick in' after around 60 to 70 minutes. In the testing I've done this was the case on every occasion and the apps and flows then worked as expected

     

    I tried with just a current value ,just a default value and both current and default values and all eventually worked as they should. The delay isn't ideal, but waiting an hour or so when transitioning to a new environment is do-able

     

    More testing tomorrow 

  • m3ngi3 Profile Picture
    725 on at
    Re: Solutions and environment variable issues

    Another latest update (also see Solved: Updating Environment Variables in Managed Solution - Power Platform Community (microsoft.com)😞 you ALSO need to remove the Default Value from the Environment Variables to get the prompt during the Solution Import. In my multiple tests of a FIRST solution import, this gave me the modern wizard prompt to update the variables right after the step to update the Connection References with Connections.

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,702 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,026 Most Valuable Professional

Leaderboard