如何使用c访问azure webjobs日志#

ezykj2lf  于 2021-06-20  发布在  Kudu
关注(0)|答案(2)|浏览(311)

我有一个按计划运行的azurewebjob,我需要访问运行日志和每次运行的输出。
我碰到了kudu api,但由于我不确定要通过web请求传递哪些凭据,所以无法进一步。
示例代码:

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());
    }

如果使用我的azure管理员帐户,我将获得401授权。
我应该使用什么用户名和密码进行身份验证?

piwo6bdm

piwo6bdm1#

您还可以使用一个定制的tracewriter。示例如下:https://gist.github.com/aaronhoffman/3e319cf519eb8bf76c8f3e4fa6f1b4ae

egdjgwm8

egdjgwm82#

请查看此页以了解可以传递给这些API的凭据类型。

相关问题