Hi @vsipranav-0854 ,
if the script should run on every restart, no matter if the restart is initiated by Azure Portal or via reboot command (inside VM) maybe this helps:
https://askubuntu.com/questions/814/how-to-run-scripts-on-start-up
As far as I know "Azure" does not recognize a reboot via reboot command. Using an "in-guest VM" approach to execute a script might be your best option.
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Andreas Baumgarten