user2245759
user2245759

Reputation: 467

Change webjob from on demand to schedule

We have an azure webjob that was deployed as on demand. Is there a way to change this to run on a schedule without redeploying?
Not a lot of info out there on this.

I tried creating a new schedule collection like this and adding a job to run the existing webjob, but that didn't seem to work either.

I prefer to do this in the GUI portal, but if its not possible, I'll do it in powershell (if it is possible like that).

(Also, if it can only be changed by redeploying, I need to know that and it effectively answers the question)

Upvotes: 4

Views: 4465

Answers (3)

user2245759
user2245759

Reputation: 467

In the end the link in the original post I referenced worked. The thing that was missing for me was the understanding that creating a trigger job in scheduler will not affect the run status (on-demand or scheduled) of the web job itself. In my case it stayed "on-demand", but the schedule was in fact running it.

Upvotes: 2

Amit Apple
Amit Apple

Reputation: 9192

To easily add a schedule to your triggered (on demand) webjob add a file called settings.job at the root of your webjob with this content:

{"schedule": "the schedule as a cron expression"}

Find out more about this here

Note: it'll only work properly for Standard or Premium sites and requires you to set the site as always on.

Upvotes: 6

Andrew Moll
Andrew Moll

Reputation: 5043

This should point you in the direction on how to do this via PowerShell. It looks possible to add already existing WebJobs to a scheduler.
Create a Scheduled Azure WebJob with PowerShell

Upvotes: 1

Related Questions