Have you ever noticed the following paragraph in the Canvas Apps coding guidelines?
Periodically republishing your apps
The PowerApps product team is continually optimizing the Power platform. Sometimes, for backwards compatibility, these optimizations will apply only to apps that are published by using a certain version or later. Therefore, we recommend that you periodically republish your apps to take advantage of these optimizations
Personally, I initially dismissed it as some kind of weird recommendation when I was reading the guidelines a while back. Since, after all, would you really want to go back to the app that’s working only to republish it? You’d also have to deploy updated version in test/production from there, so this may require quite a bit of planning/coordination. Of course if you have configured all the pipelines in devops, you might be able to automate most of the technical steps, but, still, you’d have to start putting some efforts into those periodic updates.
And, yet, in the context of the issue I ran into earlier this week, it starts making quite a bit more sense.
For a little while now, environment variables have been available in the Power Automate flows:
Which is absolutely awesome, since now we can use this feature to configure flows for different environments.
For example, we are using this feature to build Power BI reports from within the flows, and we are using environment variables to identify the actual report (which is different for dev/UAT/prod, since each version of the report is using different connection settings).
Turned out environment variables have some limitations:
Most of them are almost cosmetic, but there is this one which is quite a bit more important:
- When environment variable values are changed directly within an environment instead of through an ALM operation like solution import, flows will continue using the previous value until the flow is either saved or turned off and turned on again.
So, basically, if you import a solution that has a variable into the environment, then if you follow up by importing a solution that contains a flow that’s using that variable, and if you forget to set correct value for the environment variable along the way, you might end up with a flow that’s using “default” value even once you’ve added updated “current” value.
In which case you may need to turn the flow off and on. Or you may have to re-import the flow.
Long story short, it turns out certain things can get “cached” in canvas apps / flows, and you might want to keep that in mind when working on your ALM strategy.
I wonder if, ideally, all/some of that would be done as part of “nightly refresh” job in devops, though I wonder if that would be doable. Going to try – will see how it works out.