Hello Geeks,
Here's the scenario - I'm executing Azure functions (PowerShell code) using time trigger running on Consumption App service plan. I would like to execute this function every minute. The functions basically uses bunch of Azure powershell commands to carry out the work needed. I have described the dependent Azure modules in requirements.psd1 file and have also added Import-Module statements for each of the modules in profile.ps1 file.
Expectation - After/During the initial cold start, the modules are loaded so that the subsequent function executions every minute need not load the modules and instead use the already loaded modules.
Actual - I see in app insights that for every function execution, the modules are loaded all over again leading to higher execution times. The actual script would take < 10 sec to execute however with modules being loaded the overall execution time reaches to nearly a minute.
How to ensure that the modules are always pre-loaded so that the function executions take relatively less time to execute? Thanks!