Query Application Insights in Logic App

Karl Swierenga 45 Reputation points Microsoft Employee
2024-04-25T22:19:22.65+00:00

I am trying to query Applications Insights from a logic app and I'm getting errors. I use the Run Analytics Query and my query is exceptions (which works when I do a app insights log query). When the logic app runs, I get the following error.

"Message": "Failed to get HTTP response because of invalid input (DRAFT, apiQueryDraft). Bad request input. Please Check user input parameters (query syntax, chart type or other resource input)

Does anyone have an idea on what is going on? Is there a format the query needs to be in?

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,899 questions
0 comments No comments
{count} votes

Accepted answer
  1. Aki Nishikawa 805 Reputation points Microsoft Employee
    2024-04-27T01:45:45.16+00:00

    Hello @Karl Swierenga ,

    Is this the instrumentation key?

    No, you have to create API key by yourself. The following documentation is a part of Bot Service, but it describes how to create API key and how to retrieve Application ID in Azure Portal.

    https://learn.microsoft.com/en-us/azure/bot-service/bot-service-resources-app-insights-keys?view=azure-bot-service-4.0#api-key

    If you are familiar with Azure CLI, check the following URL; Azure CLI reference to create API Key of Application Insights.

    https://learn.microsoft.com/en-us/cli/azure/monitor/app-insights/api-key?view=azure-cli-latest#az-monitor-app-insights-api-key-create

    If you're using Azure Monitor connector to retrieve data from Application Insights, how about using managed identity authentication? It allows you to configure connector much easier. You should grant Reader or Monitoring Reader role of target Application Insights to a managed identity of Logic Apps.

    https://learn.microsoft.com/en-us/connectors/azuremonitorlogs/ https://learn.microsoft.com/en-us/azure/azure-monitor/app/app-insights-azure-ad-api


2 additional answers

Sort by: Most helpful
  1. Aki Nishikawa 805 Reputation points Microsoft Employee
    2024-04-26T12:56:20.0833333+00:00

    Hello @Karl Swierenga ,

    I'm not sure what your query is, but basically the same query as one which works on Log Analytics Workspace should be entered to the query field. On my environment, the following query worked fine.

    exceptions
    | project timestamp, severityLevel, details
    

    Here is a designer image.

    User's image

    0 comments No comments

  2. Karl Swierenga 45 Reputation points Microsoft Employee
    2024-04-26T21:36:34.3133333+00:00

    I'm thinking the problem might be with my connection to app insights. What are you using for the API Key. Is this the instrumentation key?

    0 comments No comments