azureazure-webjobskudu

How to access Azure Webjobs log using C#


I have a azure webjob running on a scheduled basis and I need to access the run logs and the output of each run.

I bumped into kudu api, but couldn't go any further as I was not sure which credentials to pass with my web request.

Sample Code:

private static void GetAPIData2()
    {
        String Url = "https://MyWebsite.scm.azurewebsites.net/azurejobs/api/jobs";
        WebRequest request = WebRequest.Create(Url);

        request.ContentType = "application/json";
        request.Method = "GET";

        //Your Azure FTP deployment credentials here
        request.Credentials = new NetworkCredential("What should go here?", "and here?");

        WebResponse response = request.GetResponse();
        Console.WriteLine(response.ToString());
    }

I get 401 Unauthorized if use my azure administrator account.

What username and password should I use to authenticate?


Solution

  • Please take a look at this page to understand the kind of credentials that you can pass to these APIs.