How can I set up a CRON job using Windows Azure? - azure

Is there a way to use the windows scheduled task to kick off a url or a exe on a schedule?
Can I write a program as an exe then create a Azure VM then RDP into the Azure VM and hook it up to windows task scheduler?

Azure does have a scheduler now.
It allows invoking a Web Service over HTTP/s and post a message to a Windows Azure Storage Queue. It's very new but it can be free if you do not need the scheduler to be executed often. Otherwise it's a small monthly fee which come with scheduled task that can be up to every minute.

Things got much easier lately, please see this link https://azure.microsoft.com/en-us/services/scheduler/ to create a scheduled job in the new Azure Scheduler. There is a basic Free tier as well as some paid options but I think this is exactly what many of us were looking for. It is an excellent solution for triggering URLs with GET,POST,PUT,DELETE requests.
Just follow the simple instructions. Starting by selecting "Scheduler" from the Azure dashboard app menu:

Today the scheduler has been Azure Logic Apps:
https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-overview
If you are looking for something like a cron job (which is a job, that is being run at specific time again and again), then check out Azure Functions:
https://learn.microsoft.com/en-us/azure/azure-functions/functions-overview

Google Azure Storage Queues. They allow you to schedule jobs that will run at a later date. You can even specify when the job should run.

Related

Scheduling tasks on Node when scaling the app on cloud instances

If I want to schedule a task to run say once every 30 minutes. I could do this with a basic timeout or use a node module like node-schedule.
But If I deploy my app to the cloud, such as Amazon AWS or Azure, and scale the instances to say 10, will this task then be scheduled to run 10 times, one for each instance? How can I avoid this, or am I thinking about how cloud instanced work in the wrong way.
If you want to use an Azure component, you could use the Azure scheduler:
Create jobs that run on your schedule
Azure Scheduler lets you create
jobs in the cloud that reliably invoke services inside and outside of
Azure—such as calling HTTP/S endpoints or posting messages to Azure
Storage queues. You can choose to run jobs right away, on a recurring
schedule, or at some point in the future.
Azure Scheduler
It entirely depends on your code but I'd imagine that yes it will run on each instance, probably slightly out of sync too.
This article describes quite nicely the problems with scheduled tasks:
http://dejanglozic.com/2014/07/21/node-js-apps-and-periodic-tasks/
My advice would be to try and avoid scheduled tasks as much as possible.

Microsoft Azure Worker Role or Azure Scheduler for Backup and Restore?

Creating Backup and restore Azure Table Storage Scheduler, where user will schedule the job or task to backup Azure Table at particular time, from Wizard. Which way I must Prefer?
Should I use Azure Service i.e Creating WebRole and Worker Role.
In this case how to Execute Worker Role on Schedule.
Can I use Web Job with Scheduler?
How to use Azure Scheduler to achive this task? I have googled out
where in some blogs they suggested to use Scheduler with Azure
Queue.
You can use either. Azure WebJobs are simpler and easier to use and would work well for your scenario.
You can use Azure WebJob with Azure Scheduler. You can set the schedule ahead of time where the scheduler will trigger the WebJob where you can perform your backup task.
Please see these articles
http://azure.microsoft.com/en-us/documentation/articles/websites-dotnet-deploy-webjobs/#configure
http://azure.microsoft.com/en-us/documentation/articles/web-sites-create-web-jobs/#CreateScheduled
I would use the Azure Scheduler. If your are familiar with a Cron job, this is very similar. All the Azure Scheduler does is make a REST call to an end point on a schedule. This would probably be more cost affective then setting up a worker role. Also, I would make sure to take into account security when setting up the Azure Scheduler. I would pass some type of secret to the API as a parameter so that it's not open to anonymous calls (although technically it would be.) If you want to execute certain tasks during the call, then I would store them in a table in your database. The worker role came before the Azure Scheduler, so the worker role lost in my book when the scheduler was made public.
UPDATE:
Another thought, is to look into the automation option in Azure: https://msdn.microsoft.com/library/azure/dn643629.aspx
With this option you can execute PowerShell scripts:
http://azure.microsoft.com/blog/2014/08/20/azure-automation-capabilities-in-depth-the-azure-automation-powershell-cmdlets/

Difference among Azure batch, scheduler and web job and when to use what

I could see primarily there are 3 options in Windows Azure to schedule jobs. Batch, scheduler and web jobs. Is there any link or video explaining what are the differences and what to use when and benefits?
Thanks in advance
So far I didn't see anything official from azure.com or msdn, so let me take a stab.
Azure Batch - is a way to run parallel (typically compute intensive) HPC style job on the cloud. Batch pitches the value of parallel job running as a service so you don't worry about provisioning/managing large cluster. A typical scenario is, go encoding those 10K H.264 videos from 1080p to 720p - instead of spinning up 200 VMs you just configure the command line and specify the location of those 10k videos (blobs).
Azure Scheduler is a way to run recurring job at specified time. It's Windows Task Scheduler in cloud. For example, start a cloud service 8AM every weekday and shut it down at 6PM.
Azure Web Job is focusing on doing background job for Azure Website. It's working daemon web server farm in cloud. An example is - compress all images uploaded from the webpage.
To add to Yiding answer, Azure Scheduler and Azure WebJobs actually work together and complete each other in that sense.
Azure WebJobs will host your code/executable that is doing the work.
Azure Scheduler will schedule when to run your work --> WebJob.
To start create a scheduled Azure WebJob which will create both resources.

Asynchronous tasks in Microsoft Azure

I have a Website (on Azure) where you can trigger asyncronous jobs, that needs a lot of traffic (copy files from one location to another).
So you press a button on the site and then I want to trigger a new job. What would be the best solution?
Solution 1) Use web jobs. But then there may problems with huge traffic, so that the website will not be reachable.
Solution 2) Use cloud service. Is it a good solution to start a new instance for each job? The jobs will not need a lot of cpu usage, but the traffic will be the point.
Solution 3) Is there any solution on azure, where you can just trigger a job, and ervery time it is triggered, a new instance will start, do the job and shutdown. Like fire and forget?
Put a job message in an Azure Storage queue. Use an Azure Cloud Service worker role to consume the message and do whatever processing needs to be done.

Azure webjobs vs scheduler

A very simple question:
Why would someone use the Azure Scheduler if Azure WebJobs are free?
I couldnt find any topic regarding "azure webjobs vs azure scheduler"
The main difference is that the webjob contains everything that the scheduler can do:
Scheduler can make HTTP calls
WebJob can do that and more (run SQL commands, etc)
The actual scheduling bits of WebJobs are built on top of the scheduler. When you set up a Web Job on a schedule under the hood it uses the scheduler to kick it off. WebJobs provides a nice little location to host the code that gets executed. In fact, if you create WebJobs for a web site look in the Scheduler on the portal and you'll see them listed there as well.
Also note that the scheduler could call out to other systems not running Azure. If you have something running in a Cloud Service that needs to be called regularly, or even if something was hosted elsewhere (another provider or on premises) the scheduler is where you can set that up.
Regarding the cost aspect, there is a free tier to the scheduler as well: http://www.windowsazure.com/en-us/pricing/details/scheduler/.
It's 2016. The below answers are no longer accurate.
WebJobs now also has a built-in scheduler and the schedule can be defined by a cron expression.
When publishing to Azure, you can choose if you want to have the WebJob sparked off by the Scheduler or by the WebJob internal scheduler.
Important Note: The Azure Scheduler has limits to frequency of either 1hr or 1min depending on if paid or not. For the internal scheduler however, your App Service requires Always On to keep on running and firing off the job. This Always On status may affect your pricing.
Continuous jobs are monitored, and if they exit they are re-executed. In this way they act more like "services" in your local machine. There is a module that monitors and keeps your app working. Always-ON is a feature that will help your site stay alive and hence, your webjobs to continuously run.
Scheduler is used to trigger the webjobs. It uses the scheduler user account (not the back-end account). This way you can move out of the free tier for scheduler, sign up to higher tiers to suit your needs. But essentially, all the scheduler is doing is hitting an https endpoint (which is public, but required your auth).
Triggered jobs (scheduled and on demand) are invoked by an https call. These calls are load balanced - much in the same way that a web app with many instances is load balanced. Continuous jobs run concurrently by default, but can be set to be a singleton.
For Webjobs starting from version 2, there is no reason to use an Azure Scheduler anymore. As a matter of fact, the Azure Portal already flags this functionality as (Legacy).
From WebJob SDK v2 additional triggers have been introduced and one of them is TimerTrigger, which works with CRON expressions to schedule executions. This execution mode does not need any additional Azure construct, you just need the webapp to be set as AlwaysOn to guarantee the webjob to run.
Another azure service that works with TimerTriggers is Azure Functions, which is built on top of the WebJob SDK that allows a serverless execution.

Resources