none
Query over resources in multiple subscriptions in different directories RRS feed

  • Question

  • Hi!

    How can I query over multiple resources in multiple subscriptions in different directories?

    The setup we use to have was that every application build by every team was in one subscription in one directory. This was very useful for application insights, because it automatically connected the application insights of the different applications. Also querying was quite easy.

    Currently we have a new setup, the applications build by my team and supported by my team is in a new subscription in a new directory. Still I want to have insights in the performance and problems. 

    If I understand this page in the documentation correctly I should use the "app" operator. When I try to use the application id like this:

    app("my-guid").exceptions
    | take 1

    I get the following error:

    You don't have permissions to query this application:
    
    - my-guid
    
    If issue persists, please open a support ticket.
    
    Request id: 124998b0-1e2f-4d17-8f88-8dd835643e4d
    Need Help?
    See the language reference
    Ask the community

    And if I try it with the resource id:

    app("/subscriptions/subscription-guid/resourceGroups/rg-My-Name/providers/microsoft.insights/components/ai-My-Name").exceptions
    | take 1

    The I get the same error:

    You don't have permissions to query this application:
    
    - /subscriptions/subscription-guid/resourceGroups/rg-My-Name/providers/microsoft.insights/components/ai-My-Name
    
    If issue persists, please open a support ticket.
    
    Request id: 110caf98-99ab-4736-b546-a46fc30891cc
    Need Help?
    See the language reference
    Ask the community

    Is it possible to query over multiple resources in multiple subscriptions and different directories?

    How should I query then?

    Thank you in advance!

    Thursday, February 6, 2020 7:16 AM

All replies

  • Hello Jornes,

    Thanks for reaching out !!

    Please ensure you have followed the below notes:

    - You must have read access to the application.
    - Identifying an application by its name assumes that it is unique across all accessible subscriptions. If you have multiple applications with the specified name, the query will fail because of the ambiguity. In this case you must use one of the other identifiers.
    - Use the related expression workspace to query across Log Analytics workspaces.
    - The app() expression is currently not supported in the search query when using the Azure portal to create a custom log search alert rule, unless an Application Insights application is used as the resource for the alert rule.

    You can refer below doc for the identifier argument reference:

    https://docs.microsoft.com/en-us/azure/azure-monitor/log-query/app-expression#arguments

    I just simple created a function in Azure monitor using below query:

    union
    app('ApplicationInsightName1').requests,
    app('ApplicationInsightName2').requests
    

    then i pinned it to the dashboard and it worked perfectly fine for me.

    Please check the permission and try it it should work.

    Feel free to tag me in your conversation for any help.

    Additional Reference:

    https://docs.microsoft.com/en-us/azure/azure-monitor/log-query/app-expression

    Friday, February 7, 2020 9:53 AM
  • Hi MohitVerma,

    Thank you for your answer, unfortunately it doesn't work. It is something I already tried before posting my question here. 

    The link you provide specifies the different ways to use app, as you can read I tried them all.

    I have read access in both subscriptions, but they are in different directories. Is this the problem?

    13 hours 40 minutes ago