0

I can get a WebJob work from azure protal.

I tried to deploy it from VS, and the result was: 401 - Unauthorized: Access is denied due to invalid credentials.

I tried set the URL like this article suggested http://blog.davidebbo.com/2015/05/scheduled-webjob.html

https://{userName}:{password}@{WebAppName}.scm.azurewebsites.net/api/triggeredwebjobs/{WebJobName}/run

..but the portal didn't let me (shows an error in the field). I tried this froma rest api tester and works!

I have to recreate the collection and the scheduler in the standard tier so I could include authorization (but not in the URL eather). Now I'm getting this error: Http Action - Request to host 'hobbule.scm.azurewebsites.net' failed: The job is missing basic auth fields.

Configuration of webjob

*MSDN question https://social.msdn.microsoft.com/Forums/azure/en-US/5d47cd51-bd60-4f00-9cba-322b020a8810/azure-scheduler-ui-problem?forum=azurescheduler

Sebastián Rojas
  • 2,776
  • 1
  • 25
  • 34

1 Answers1

2

You have to add a Basic Authorization header to the headers collection. The header value is is the Base 64 encoding of the bytes of a string comprised of your username / pwd. See this question for more info. You could also use the PowerShell commands to set up the schedule for you.

Community
  • 1
  • 1
mathewc
  • 13,312
  • 2
  • 45
  • 53
  • Can you please explain me how to generate thta Base 64 value for the header – Sebastián Rojas Jan 29 '16 at 02:19
  • 1
    [This post](http://chriskirby.net/running-your-azure-webjobs-with-the-kudu-api/) shows you how to generate it. – mathewc Jan 29 '16 at 03:49
  • So Azure Scheduler UI has a bug...it should make the var byteArray = Encoding.ASCII.GetBytes("username:password"); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray)) part... – Sebastián Rojas Jan 29 '16 at 05:03