Azure Webjobs are missing after deployment of App Service or web app


Webjobs are missing after deployment of App Service or web app


Issue:

·       My web jobs are deleted after deployment.

·       I am not able to see webjobs in the portal

·       I am sure I haven’t deleted it


Solution:

This is very common scenario. Many users face this issue which is very critical sometimes as web job can be performing some critical business scenario.

One important point which everyone should know is, webjobs are deployed inside App_Data folder inside WWWROOT of your app service.

The complete path depends on type of webjobs.

Triggered webjobs path - WWWROOT\app_data\jobs\triggered\ {job name}
Continuous webjobs path- WWWROOT\app_data\jobs\continuous\ {job name}

You can see clearly that both webjobs are stored inside the app_data folder.




Now due to some reason if either App_Data folder is deleted during deployment or we publish web app with option “remove additional files at destination” while App_Data folder is not part of source code then it will delete existing App_Data Folder.

Here I am giving example for DevOps aka VSTS where we have 2 options,
·        Remove additional files at destination
·        Exclude files from the App_Data folder

You can check this in the official document also,





I believe this explains the issue and help us to understand why my webjobs are missing.




Make sure you take care of this checkbox during deployment if you have any web job.



Update or change webjobs types


Update or change webjobs types


Issue:

·       Change webjobs from Triggered to Continuous

·       Change webjobs from Continuous to Triggered


Solution:
 There are 2 types of web jobs,
·       Continuous
·       Triggered

Sometimes we want to change the webjob's types e.g. Triggered to Continuous or vice versa.
There is no direct way to achieve it. We don’t have any REST API which can help us to update or change webjobs type.

Please refer below workaround to achieve it.

Examples is for updating webjobs from triggers to continues.

1.     Create a Triggered webjob from the portal.


Update or change webjobs types


2.     Go to KUDU site.

3.     All web jobs are stored inside jobs folder.

Complete path is: D:\home\site\wwwroot\App_Data\jobs

You can see, a Triggered folder is created after creating a triggered web job.


4.     Go to inside triggered folder and download the web job.



5.     Go to D:\home\site\wwwroot\App_Data\jobs  and create a new folder with name “continuous


6.     Create a new folder inside Continuous folder. This new folder name will be the name of your web job.





7.     Go to inside that folder and drag and drop the webjob content which we downloaded in step 4. It will extract the content from the zip folder.



8.     Now go to Web app portal-> Web job and refresh the webjobs.



9.     You can notice a new web job with  “continuous” type is created.
10.  Now you can delete the Triggered webjob as you have converted your Triggered web job to continuous web job.
11.  Similar process you can follow to convert Continuous web jobs to Triggered web jobs.