Scheduled Tasks have been around since the early days of Windows Server. The task scheduler is the inbuilt component used to plan and execute jobs. Typically, System administrators use them to automate reoccurring activities which are defined in scripts.
While Scheduled Tasks are robust and easy to use, they have a couple of shortcomings.
This blog explains the advantages of Azure Automation or Function App over Scheduled tasks.
Looking on Scheduled Tasks and their opponents in Azure
Storage / Location
Scheduled Tasks are stored on an individual computer. – If the computer requires replacement or decommissioning, the task needs to be migrated.
Azure Services live in the cloud and have no fixed relation to a computer.
Execution
Scheduled Tasks are executed on an individual computer. – In case the computer is unavailable, the task will not run.
Azure Services run typically in the cloud OR on designated computers.
Redundancy
Scheduled Tasks have no redundancy options out of the box. – They are typically stored only on 1 computer.
Azure Services provide different options for been redundant. Even if execution is on computers.
Change Tracking / Versioning
Scheduled Tasks are changed on demand without direct support of managing the change properly.
Azure Services can be connected to a Version Control System, e.g. Azure DevOps and allow tracking on changes and versioning via underlying GIT protocol.
Monitoring
Scheduled Tasks can be monitored on a the individual computer. For centralized monitoring the use of SCOM or an alternative Server-Monitoring system is required.
Azure Services can send diagnostic and performance data via single click to a central Log Analytics Workspace. Kusto queries allow monitoring and alerting.
Security
Scheduled Task run typically under the context of “System” which has the highest level of permissions on the individual server. By using the computer object, permissions on remote locations, like file-shares or others can be granted.
In cases a dedicated User account is created, has to be granted sufficient permissions on the computer to run the task. Typically the password is stored and never changed.
In worst cases, the credentials are stored in plain text within the script.
Azure Services can leverage a “managed identity” which password is neither exposed nor it requires attention. Furthermore, if credentials for different operations within the script are needed, the managed identity can be granted access to a Key Vault to obtain secret information securely.
Costs
Scheduled Tasks are part of the Windows operating system and do not come with extra costs or licenses.
Azure Services offer free tiers or are charged for minimal wages.
Round Up
To conclude, Azure Runbooks and Function Apps outperform the traditional Scheduled Tasks in many aspects.