We are warned when we open the console of our application by ssh:
Note: Any data outside '/ home' is not persisted
Therefore, a possible solution in this case is to launch a script at the start of the application, so that after each restart the cron service is installed and the work necessary to execute the Laravel scheduller tasks is created. I'll explain what has worked for me for my PHP + Laravel application hosted on Azure Linux Webapp:
1. Create the start script /home/startup.sh:
apt-get update -qq && apt-get install cron -yqq
(crontab -l 2>/dev/null; echo "* * * * * /usr/local/bin/php /home/site/wwwroot/MyAppFolder/artisan schedule:run >> /home/cronresult.txt 2>&1")|crontab
service cron start
Note: note that we are indicating that our PHP PATH is in the /usr/local/bin/php directory. We will have the output of the command in a file /home/cronresult.txt, which will help us in debugging any problem from its execution.
2. Set ‘/home/startup.sh’ as ‘startup command’ in our azure panel, as indicated by @HeyMan in his answer.
3. We will have to restart our application for the startup script to load.