Hi @Andrey Kozichev ,
Thank you for reaching out to MS Q&A.
This happens because the part of the Function App that watches for new files in the Storage Account sometimes goes inactive and doesn’t start checking for new files when they’re added. That’s why it only starts working when you open log streaming or the console, it restarts the function’s listener.
To resolve the issue,
- Ensure "Always On" is enabled and the
AzureWebJobsStorage
connection is valid with proper storage firewall settings. - Make sure the
WEBJOBS_DISABLE_SCHEDULE
setting isn’t set to1
, if it is, the function’s triggers won’t work. Refer to the MS Doc for a better understanding.
To prevent the Function App from going idle, add a simple Timer trigger that runs every 5–10 minutes to keep the app active.
python :
import datetime
import logging
import azure.functions as func
app = func.FunctionApp()
@app.function_name(name="mytimer")
@app.timer_trigger(schedule="0 */5 * * * *",
arg_name="mytimer",
run_on_startup=True)
def test_function(mytimer: func.TimerRequest) -> None:
utc_timestamp = datetime.datetime.utcnow().replace(
tzinfo=datetime.timezone.utc).isoformat()
if mytimer.past_due:
logging.info('The timer is past due!')
logging.info('Python timer trigger function ran at %s', utc_timestamp)
nodejs :
const { app } = require('@azure/functions');
app.timer('timerTrigger1', {
schedule: '0 */5 * * * *',
handler: (myTimer, context) => {
context.log('Timer function processed request.');
},
});
Hope this helps.
If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.