Using the right-click, Publish as Azure WebJob... option in VisualStudio 2015, the job is published however the runMode seems to be ignored.
In my file, I have the following settings, however the job is continually set to an On Demand job in the portal after publishing:
{
"$schema": "http://schemastore.org/schemas/json/webjob-publish-settings.json",
"webJobName": "MyJob",
"startTime": "2015-07-21T00:30:00-08:00",
"endTime": null,
"jobRecurrenceFrequency": "Day",
"interval": 1,
"runMode": "Scheduled"
}
Using Visual Studio 2015 with the Azure SDK for .NET 2.7
Here is the Error in the output windows after publishing Error : An error occurred while creating the WebJob schedule: Could not load type 'Microsoft.IdentityModel.Clients.ActiveDirectory.ActiveDirectoryAuthenticationException' from assembly 'Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.16.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
On my case even though I'm already logged into Cloud Explorer I still get the same error.
I have the latest Azure SDK for .NET (VS 2015) installed as of writing. I had to update my NuGet package Microsoft.Web.WebJobs.Publish from version 1.0.2 to the latest version which is 1.0.10. NuGet Package Upgrade
Then finally the web job was published successfully!
When deploying for Visual Studio, check the Output Window. You should see that it builds your project, and then it will seem to have finished. About 30-90 seconds later, you will see any errors that may occur with the scheduling part of the deployment. You will also see them in the "Azure App Service Activity" window, which will give you a full log of the deployment.
As there's quite a delay where nothing seems to be happening while it deploys, it's easy to miss any error message that may occur. If you see an error, post it here and we can debug further. Thanks.
Based off of the error, the issue is that you must be logged into Cloud Explorer within Visual Studio for the job to be scheduled properly.
The job will still publish if you are not logged in, however it will only be available OnDemand.
There is now a better way of scheduling WebJobs using CRON expressions, which is simpler and avoids all the Scheduler issues mentioned here.
To use it, do the following:
settings.job
file at the root of your WebJob. Make sure to set Copy to Output Directory='Copy if newer'. This file should contain something like this (which makes it run on the top of each hour):{ "schedule": "0 0 * * * *" }
For more information, about this technique, see the following links:
https://azure.microsoft.com/en-us/documentation/articles/web-sites-create-web-jobs/#CreateScheduledCRON
http://blog.amitapple.com/post/2015/06/scheduling-azure-webjobs/