I would imagine this is very simplified approach to send the logs this way. You cannot guarantee you caputed all logs because you rely on the time intervals which is hard to deal with without saving last successfull interval. And you don't have any logic to remidiate failed delivery. Also certain limits applied to the Log Analytics Query API. So this code will dramatically grow at the final version.
Log analytics can export many standard Microsoft tables from the Log Analytics to the EventHub (which wil definitely cost extra) with native Export functionality of the Log Analytics. And then use function to send the logs from EventHub.
WIsh Microsoft made Log Analytics to be tenant agnostic when you configure logs export, this would solve so many problems.