Inside our on-premises SharePoint server, we have many background jobs which runs as follow:-

1) Using Windows Tasks Scheduler we define some c# console applications which run daily and hourly.

2) We define the tasks to run under the site collection administrator account, so we do not have to store the password inside the console applications.

Now we are planning to migrate to office 365, and turn off the on-premises server. so i am not sure what is the alternative to using Windows Task Scheduler in the Office 365 world? in a way that allow us to run the tasks in a schedule basis under the site collection admin or Office 365 admin username/password ?


2 Answers 2


Azure Automation would be my go-to; these can be kicked off by a Flow or Azure Automation has a built-in scheduler.

And don't use a user account for these tasks; rather create an Azure AD App and provide the correct permissions it needs to perform the task. You should consider using certificate authentication, or at a minimum, App ID/Secret.

  • ok thanks for the reply and info. now i have re-write our console applications to use CSOM, so can i use the c# console application within the Azure Automation or i have to re-build the console application again?
    – John John
    May 14, 2020 at 20:16
  • 1
    You can also use PowerShell with Azure Automate. I do this for PnP deployments.
    – Trevor Seward
    May 14, 2020 at 20:51
  • so can I use console app with Azure Automate ?
    – John John
    May 14, 2020 at 21:52
  • It's designed for PowerShell/Python rather than C# applications as outlined at docs.microsoft.com/en-us/azure/automation/…. C# you could use with Azure Functions (v1) which also has scheduling capabilities.
    – Trevor Seward
    May 14, 2020 at 22:20

Please check this article about different automation services, which compares the following Microsoft cloud services:

  1. Microsoft Power Automate (aka. Microsoft Flow)
  2. Azure Logic Apps
  3. Azure Functions
  4. Azure App Service WebJobs

If you don't want to go for PowerShell (when you can use Azure automation, as suggested by Trevor), then you can try last 2 options from above.

Azure functions can be run using a Timer trigger, here is one sample.

Web job can run in a pre-defined schedule, here is one sample for this.

It really doesn't make sense to create an Azure web app just to use the Web Jobs functionality, but we occasionally do such things :) I have actually used Azure Web jobs for one of my clients to communicate with SharePoint online and do stuff periodically, it worked fine.

Also, look out for Azure automation changes, they might come up with some mechanism to run C# console application or .bat files very soon.

  • thanks a lot, now i read about azure web app, and seems they have their own architecture. my question was how i can run the current console application using azure.. i have converted the console app from server-side to CSOM,, so i want to just schedule them inside azure as-is... is this possible?
    – John John
    May 14, 2020 at 23:03
  • 1
    Just compress (zip) your bin folder, upload it in the web job and schedule it. It's very easy. Check this page: docs.microsoft.com/en-us/azure/app-service/webjobs-create
    – UBK
    May 14, 2020 at 23:07
  • 1
    Here is a better example you can follow step by step : docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/…
    – UBK
    May 14, 2020 at 23:09
  • 1
    Azure Functions would be more appropriate than WebJobs -- Functions are explicitly designed for this type of scenario where-as WebJobs are generally used along side of the website they host -- this dev article was created prior to Functions.
    – Trevor Seward
    May 14, 2020 at 23:44
  • 1
    I completely agree with @TrevorSeward
    – UBK
    May 15, 2020 at 0:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.