Search code examples
azureazure-application-insights

Howto Save Shared Query in App Insights


How do I save a shared query in App Insights? I can't seem to find any info on this. Am I missing it?

When I go to save a query, I don't see anything asking me about the location.

save dialog screenshot

I do see this user voice item that says it is possible. And I see Shared Queries in the Query Explorer:

query explorer screenshot


Solution

  • From this article

    What you need is the Application Insights Component Contributor and Application Insights Snapshot Debugger roles on the applications insights instance as described in the Resources, roles, and access control in Application Insights page. With these roles, you can create and edit existing functions as well as shared queries.

    Steps to do this in Azure Portal

    1. Go the Application Insights instance (the same place you run queries will do).
    2. Click "Access Control (AIM)" in the left-most nav panel.
    3. On the "Grant access to this resource" panel click the "Add role assignments" button.
    4. Fill out the form:
      • Role: "Application Insights Component Contributor"
      • Assign access to: "User, group, or service principal"
      • Find your user or search by email address for the last field
      • Save
    5. Repeat step 4 but for the "Application Insights Snapshot Debugger" role

    Notes

    • You may need an administrator to add the role if you don't have permissions.
    • The form values for who to assign the role may vary depending on how your company manages roles and RBAC. Ideally all employees needing these permissions would be in a group and the roles would be given to the group.
    • It is possible only one of these roles is needed for saving Shared Queries. The article mentions two permissions, but one may be specifically for creating/editing custom functions.

    Application Insights Access Control Screenshot

    Application Insights Access Control Page