We are migrating our SharePoint environment to O365. i am not sure whether to use azure web jobs or functions to migrate timer jobs to SharePoint Online. please let me know that what will be the best approach and what are the factors to decide that?
Basically, there are a few key factors you should take into consideration.
Functions have two types of billing schemes:
In consumption you pay only for a time when you function is running, however, under consumption plan, your function can't run more than 10 minutes. Which means, that if your jobs run more than 10 minutes Consumption plan is not for you.
App Service plan is the same plan used by Azure Web apps, you don't have time limitation here (as per documentation).
In general, Azure Functions are good when you need flexible logic with different triggers, etc. In that regards, I would say that Azure jobs are a better choice for running SharePoint jobs. Jobs have solid SDK (Functions is still changing, V2 was released recently and things are still changing).
Please also check out PnP remote timer job framework, it contains some ready to use helpers for online timer jobs.
From my understanding, you have to use Azure webjobs for sharepoint online. Because Sharepoint online is host in Microsoft which means normally the highest permission can go is site collection level. Timer jobs usually are performed at Sharepoint farm level which is inaccessible from Sharepoint online.
For Detail Microsoft Azure WebJobs, you can review it here.