0
votes

In VSTS Release, how do I stop all continuous webjobs and remove schedule from triggered webjobs for specific deployment slot?

scenario:

I have a asp.net core web application with bunch of webjobs. Some of them are scheduled, some are continuous.

In VSTS Release I deploy the webjobs together with web app to App Service using Web Deploy.

However, in staging environment I don't want to run the webjobs, since they would interfere with production (the share the same database, etc).

I guess I would have to write some powershell to stop the webjobs. It comes down to these steps:

  1. How do I run PowerShell in VSTS that is connected to my Azure Subscription
  2. How do I list all webjobs for my webapp and deployment slot
  3. How do I stop continuous webjob
  4. How do I set trigger to manual and remove schedule from scheduled webjobs
1

1 Answers

0
votes

You can set two sticky app settings on the staging slot:

  • WEBJOBS_STOPPED: 1
  • WEBJOBS_DISABLE_SCHEDULE: 1

Actually not sure if you need the second one even. Source: Kudu Wiki

Then WebJobs will not run on that slot, and by setting the slots sticky (i.e. slot settings), they will stay on the staging slot and not be swapped with the app.