Search code examples
azure-application-insightsazure-data-explorerazure-log-analyticskql

How to invoke App Insights Shared Query (from another workspace)


I have a Shared Query in an App Insights workspace, and I would like to invoke it and use its results in Log Analytics workspace. Is this possible, and if so, what is the syntax?

I am able to access the App Insights tables from Log Analytics by doing app("app insights name").tableName so I know the cross-workspace situation should allow this if invoking a shared query is at all possible.


Solution

  • I tried to find documents on cross-resource query with the shared query but failed.

    And in my opinion, it's also impossible to achieve it. Shared query is used to save a usual kql and share it with other users which has permission to access that application insights instance. I tried to sign in another account and I can see the shared query in the menu. It's designed for share not play the role as a function to call in some other place.

    Per my testing, with cross-resource we can also get the same result as what in app insights.

    enter image description here

    I think you can save the cross-resource query as a function in log analytics workspace so that you can use it directly without writing it each time you wanna use this query. Just click the save button and select save as function.

    enter image description here