Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable a Triggered Azure WebJob

I've got a webhook-triggered Azure WebJob. For... reasons, I do not have control over the system that is sending the webhooks. One webhook per day is sent. It is the only WebJob hosted by the WebApp.

During testing I wanted to disable this WebJob, so I stopped the WebApp. Much to my surprise, the WebJob ran even though the WebApp was disabled.

So my question is two-fold:

  1. Is the ability to trigger a WebJob while a WebApp is disabled intentional, or did I encounter some sort of bug?
  2. If this is intentional, is there a way to disable this job being triggered via the Azure portal?

If the only solution to my problem is to have the WebJob check a config value to determine whether to run or not, that will do. I just think there has to be a way to disable a WebJob through the portal that I'm missing.

like image 521
Joe Cullinan Avatar asked Sep 21 '17 22:09

Joe Cullinan


People also ask

How do I cancel Azure scheduled web job?

The simplest is to just hit the Restart button in the Azure portal for the Web App that hosts your WebJob, giving a clean start to all processes.

How do you stop a Web Job?

You can't stop triggered WebJob while it is in running state. If you want to stop it, you have to delete the WebJob and remove the “settings. job” and upload it again. Then invoke the WebJob when you want to run: https://github.com/projectkudu/kudu/wiki/WebJobs-API#stop-a-continuous-job.


2 Answers

You can also set the WEBJOBS_STOPPED setting in app settings, especially if publishing to a dev slot for example.

https://github.com/projectkudu/kudu/wiki/WebJobs

like image 112
Sentinel Avatar answered Dec 21 '22 22:12

Sentinel


Stopping the app does not stop the scm site that runs WebJobs. There is a more advanced way that you can stop it at API level, by setting state=Stopped and scmSiteAlsoStopped=true on the site object. This can be done using Resource Explorer.

See https://github.com/projectkudu/kudu/wiki/Full-stopping-a-Web-App for more detailed steps.

like image 38
David Ebbo Avatar answered Dec 22 '22 00:12

David Ebbo