Search code examples
azureazure-devopsazure-webjobsazure-webjobssdkazure-webjobs-continuous

Start and Stop of continuous Azure webJob with Azure WebApp Rest API results in 404 Error


I deployed a continuous WebJobs to my existing Azure WebApp using DevOps. It is up and running.

When I tried to stop the webJob in the Azure web frontend it did not work. So I used the stop Command of the Azure WebApp API.

POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}/stop?api-version=2016-08-01

Surprisingly this call returned a 404 error.

However, when I executed the Get Continuous WebJob Command it returns all infos about the webJob, which means that it could be found.

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}?api-version=2016-08-01

I also tried using the Kudu API.

POST /api/continuouswebjobs/{job name}/stop

However, the stop command resulted in the same 404 response message whereas the get command resulted in a positive result that the WebJob is in State "Running".

GET /api/continuouswebjobs/{job name}

Is there any reason for this behavior? How is it possible to start/ stop the webJob using the above mentioned post requests.


Solution

  • As it turned out the way I was deploying was the root of the problem.

    Daniels answer to this question helped me a lot.

    Basically you need to create a Virtual Application within your WebApp and then deploy your WebJob to this application from within Azure Devops.

    When done this way you are in a position to successfully start/ stop the continuous webjob with all of the above mentioned APIs.