Query Application Insights in Logic App

Karl Swierenga 45 Reputation points Microsoft Employee

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

    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.


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


    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

    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.

    | project timestamp, severityLevel, details

    Here is a designer image.

    User's image

    0 comments No comments

  2. Karl Swierenga 45 Reputation points Microsoft Employee

    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