none
InsufficientAccessToResource : Cannot access 'appinsightsstage-party' with the current credentials

    Question

  • hi,

    Am try to create new alert in loganalytics of type "Custom log search".  In the query window when in enter app('someappinsightinmysubscription').exceptions and hit tab to move to next field i get error saying "query syntax error".  but using chrome developer tools in inspect ajax call made to microsoft sight to parse query and response is a error message as shown below.

    We gave contributor access to loganalytics but still error persists. please advise.

    {"error":{"message":"The request had some invalid properties","code":"BadArgumentError","details":[{"code":"InsufficientAccessToResource","message":"Cannot access 'appinsightsstage-party' with the current credentials","target":"query","value":"appinsightsstage-party"}],"innererror":{"code":"BadArgumentError","message":""}}}

    Monday, December 31, 2018 6:40 PM

All replies

  • A good place to start would be the documentation on Log alerts in Azure Monitor, however this appears to be a credentials/access issue.  Have you confirmed that you are using the correct credentials and that those credentials have access?
    Tuesday, January 1, 2019 10:02 PM
    Moderator
  • i checked with my team admins and they too getting same error with their login.  Also they tried to gave access to log analytics service principal more access but still we got same error.
    Wednesday, January 2, 2019 5:20 PM
  • Hi Krishna-singh,

    Thanks for using Azure Log Analytics and Application Insights.

    If the intent is to create an alert for number of exceptions you are seeing for your application in Application Insights , you can follow the below steps. This should also help to evaluate your permissions to run the queries as well.

    • Create a New Alert Rule through Navigating to Azure Portal à Monitor à Alerts à New alert rule
    • Ensure to select the Resource type as Application Insights
    • Select your Application Insights Resource ('someappinsightinmysubscription' in your example)
    • Have the Condition with Custom Log Search with query “exceptions” (just as exceptions for your example, since the count is already appended for the condition)
    • Select the Alert Logic as Number of results greater than 0 ( in your case or applicable for your requirement)
    • Also add the period and frequency at which you want to run this alert
    • Configure the Action Groups and details as per your requirement.

    For Cross Application Query or Create/Update Alert Rule you can leverage the Log Analytics API .

    Additional Documentation Reference –

    https://dev.applicationinsights.io/ai/documentation/2-Using-the-API/CrossResourceQuery   

    https://docs.microsoft.com/en-us/rest/api/monitor/scheduledqueryrules/createorupdate#create_or_update_rule_-_alertingaction_with_cross-resource

    Hope the above information helps to explore Application Insights and Log Analytics further. If you have any other questions please reach out. Thanks


    Monday, January 7, 2019 6:36 PM
    Owner
  • Hi,

    We're having a similar issue.

    08:44:24 Extension/Microsoft_Azure_Monitoring 400 Microsoft_Azure_Monitoring:

    "error":{"message":"The request had some invalid properties",
    "code":"BadArgumentError"

    The same query works fine from Azure Monitor > Logs > Search.

    As soon as we try to create an alert for any one of our Web Apps this way we get a Query Syntax Error and the above message in the browser dev console.

    I have a hunch this is related to our workspace having been migrated from an OMS preview account or something

    I've raised a support request over this as we're only able to alert on about 40% of our web apps that were connected to OMS using the now deprecated App Insights Connector which did the job perfectly imho.

    I'll report back when I hear something

    Thursday, January 10, 2019 7:56 AM