You need to enable JavaScript to run this app. Azure Function运行报错The application could not be found,求排查帮助
优惠活动
大模型
产品
解决方案
定价
更多

Azure Function运行报错The application could not be found,求排查帮助

Azure Function调用Application Insights API时返回ApplicationNotFoundError

运行Azure Function时遇到以下错误:

{"error":{"message":"The application could not be found","code":"ApplicationNotFoundError","correlationId":"blabla-blabla-bla-blablablabla"}}

我的Function代码:

[FunctionName("GetOperationData")]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = null)] HttpRequest req,
ILogger log)
{
    log.LogInformation("C# HTTP trigger function processed a request.");

    string id = req.Query["id"];

    var applicationInsightsAppId = "blablabla-blablaba-blabla-blablalbla";
    var apiKey = "thisIsMySecret";

    httpClient.DefaultRequestHeaders.Add("x-api-key", apiKey);

    var query = $@" requests
        | where id == '{id}'
        | join kind=inner (exceptions) on operation_Id
        | join kind=inner (dependencies) on operation_Id
        | join kind=inner (traces) on operation_Id
        | project id, name, url, success, resultCode,
                  operation_Name, operation_Id, client_Type,
                  client_IP, client_City, client_StateOrProvince";


    var content = new StringContent(JsonConvert.SerializeObject(new { query = query }),
        Encoding.UTF8, "application/json");

    var response = await httpClient.PostAsync($"https://api.applicationinsights.io/v1/apps/{applicationInsightsAppId}/query"
        , content);

    var responseString = await response.Content.ReadAsStringAsync();
    return new OkObjectResult(responseString);
}

错误截图:

错误截图1
错误截图2

已检查所有配置确认无异常,且我拥有Contributor角色,恳请帮忙排查该问题。

谢谢!

内容的提问来源于stack exchange,提问作者MadDev

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.14 17:55:40