0
votes

I had two scheduled jobs running in my developer program benefit subscription. I had set them up originally using the classic portal. I set them to run every hour since I am on Free Tier. Everything was working fine until I had to redeploy the code (console applications)

First problem - I could not find a way to easily update the code for the scheduled jobs so I deleted them and recreated them I tried to recreate them from the portal, first by creating the WebJob and then by going to the scheduled jobs collection and creating a schedule for the web job.

However each time it runs, it fails with the following error

Http Action - Response from host 'mysite.scm.azurewebsites.net': 'Unauthorized' Response Headers: Date: Thu, 16 Mar 2017 04:07:00 GMT

Server: Microsoft-IIS/8.0

WWW-Authenticate: Basic realm="site"

Body: 401 - Unauthorized: Access is denied due to invalid credentials.....

And some other html stuff unrelated to the error

I tried also to deploy the job directly from Visual Studio 2015 (latest update) however the same result occurs, running the job fails with the same error.

It is my understanding that even on free tier I should be able to run a scheduled job (5 of them) every hour.

Why is it failing and complaining about credentials?

EDIT: The job runs from App Service - WebJobs so there's nothing wrong with the job itself, the code executes correctly, I just can't get it to run from the Scheduler.

2
Maybe this will help: stackoverflow.com/questions/33507779/…RAS
Have you set up the Authorization header in the scheduler job? It needs to contain Basic <deployment credentials in base 64> where you need to put the deployment username and password concatenated with a colon : (<username>:<password>) and base 64-encode it.juunas
@juunas in the name value pairs? I tried it but it still fails, I put Basic in the name, and for value, I went to this site base64encode.org and put ($username:password) like that with brackets and colon like you said, and encoded it, and pasted the value into the Value field ....still didn't workerotavlas
You need to set the header name to Authorization and value to Basic <base 64-encoded string>.juunas
@juunas I tried numerous combinations, with, without brackets, and still no luck - same error "Unauthorized: Access is denied due to invalid credentials"erotavlas

2 Answers

0
votes

As far as I know, the “Access is denied due to invalid credentials” error is happened when you don’t set the Authentication information in your Scheduler Job ‘s action settings tag.

The error is like below: enter image description here

I suggest you find your webjob’s username and password firstly.

You could find it in the webjob’s properties tag.

Like below:

enter image description here

Then you could set the user name and password in the action’s setting.

It will work well.

enter image description here

0
votes

Would you be able to run your schedule based off of a Cron expression? The post highlights how to use the settings.job file to provide a schedule to execute on. Here are some example cron expressions for your to figure out if this scenario would work.