Scheduling a Web Job (console application) using Azure Scheduler


Refer this as well https://nishantrana.me/2018/02/22/update-schedule-of-existing-azure-webjobs-triggered/

Let us a create a simple console application that writes Hello World to the console which we would be scheduling using Azure Scheduler.

Have kept the example simple so that we can understand the configuration part.

Right click on the project and Publish it as Azure WebJob

We will set the mode as “Run On Demand”

For the pubish target we have selected Microsoft Azure App Service web app under which this Web Job will run.

Select the App Service or configure a new one, we have selected the existing App Service below

Click on Validate to check the connection, if everything is fine Click Next and Publish the web role.

Our TriggeredWebJob inside CRMAzureWebJob App Service

We can run it on Demand by clicking on Run.

Clicking on Logs

Will provide the details of the Web Jobs

Now to schedule the Web Job we need to create a Scheduler Job, for this go to Scheduler Job Collections and click on Add

Create a new Job inside Job Collection and provide the required details like Name, Pricing Tier, Resource Group etc.

Next step is to configure the Action settings, wherein we will trigger our Web Job.

For this we need to define Action as Https, Method as Post and the URL

Format of the URL should be like –

https://{userName}:{password}@{WebAppName}.scm.azurewebsites.net/api/triggeredwebjobs/{WebJobName}/run

To get the above details open the Web Job properties


Replace the appropriate values

https://$CRMAzureWebJob:hyNboz8Skys3yrQ2MkpYnseXr7Kborq82JhEX09B32ExtjiYkxxgwejqsH@crmazurewebjob.scm.azurewebsites.net/api/triggeredwebjobs/TriggeredWebJob/run

Last step is to schedule it

Here we have selected it to run immediately, every 2 minutes for total of 10 occurrences.


Finally click on Create which will create the job


We can monitor our Job



Going back to our Web Job Logs we can see it ran 3 times with interval of 2 minutes till that point


The other option to schedule a Web Job without using Azure Scheduler is to use the Cron Job but this requires minimum Basic tier subscription. Basically, the Web App must be configured for “Always On”, which requires a Basic or Standard plan.

http://patrickdesjardins.com/blog/azure-webjobs-using-cronjobs

http://blog.amitapple.com/post/2015/06/scheduling-azure-webjobs/#.WNCQKDt9600

And in Free tier

https://www.schaeflein.net/azure-webjobs-free-tier/

Hope it helps..