Search code examples
azureazure-webjobs

Azure WebJobs : How to stop WebJob which is in "Pending Restart" status?


When the Azure WebJob is scheduled to run continuously (and it restarts automatically & periodically), the "Start" option appears in the portal GUI to start it on demand.

But, there is no "Stop" button, which can entirely stop the scheduled run. It appears, only when the WebJob is in running state. Not in between.

Is there any other way to stop a scheduled job? Not have a stop button in the same GUI doesn't make sense.


Solution

  • You can use azure powershell cmd Invoke-AzResourceAction to stop it. The sample code like below:

    Invoke-AzResourceAction -ResourceGroupName "your_resourcegroup_name" -ResourceType Microsoft.Web/sites/continuouswebjobs -ResourceName "your_web_site_name/your_webjob_name" -Action stop -ApiVersion 2018-02-01 -Force