4

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)

user2245759
  • 477
  • 6
  • 17

3 Answers3

6

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.

Amit Apple
  • 9,034
  • 41
  • 50
  • I was trying not to redeploy. I can easily modify the deployment, but I was trying to modify while already in Azure. – user2245759 Sep 02 '15 at 12:38
  • There is no need to redeploy, just go to https://{sitename}.scm.azurewebsites.net/debugconsole you'll find a file browser there where you can add the file. easy peasy. – Amit Apple Sep 02 '15 at 15:52
  • Side note: Just ran it on a Basic site and it's also working. – JoJa Dec 06 '17 at 14:01
2

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.

user2245759
  • 477
  • 6
  • 17
1

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

Community
  • 1
  • 1
Andrew Moll
  • 4,903
  • 2
  • 13
  • 15