Resource graph query giving error

Diptesh Kumar 101 Reputation points
2024-05-17T09:36:00.5333333+00:00

I am trying to execute following query

Search-AzGraph -Query "patchinstallationresources| where type has ""softwarepatches"" and properties !has ""version""| extend machineName = tostring(split(id, ""/"", 8)), resourceType = tostring(split(type, ""/"", 0)), tostring(rgName = split(id, ""/"", 4)), tostring(RunID = split(id, ""/"", 10))| extend prop = parse_json(properties)| extend lTime = todatetime(prop.lastModifiedDateTime), patchName = tostring(prop.patchName), kbId = tostring(prop.kbId), installationState = tostring(prop.installationState), classifications = tostring(prop.classifications)| where lTime > ago(30d)| project lTime, RunID, machineName, rgName, resourceType, patchName, kbId, classifications, installationState| sort by RunID


but coming up with following error:

Please provide below info when asking for support: timestamp = 2024-05-17T09:32:18.3712443Z, correlationId = df4c3024-2392-4cb4-a9f6-10689610db59. (Code:BadRequest) Details: Query is invalid. Please refer to the documentation for the Azure Resource Graph service and fix the error before retrying. (Code:InvalidQuery) ParserFailure (Code:ParserFailure) ParserFailure (Code:ParserFailure)

More information on the error can be found here.

User's image

Please suggest what could be the wrong. thank you

Azure Update Manager
Azure Update Manager
An Azure service to centrally manages updates and compliance at scale.
260 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. tbgangav-MSFT 10,396 Reputation points
    2024-05-17T16:33:47.7533333+00:00

    Hi @Diptesh Kumar ,

    Search-AzGraph is a PowerShell cmdlet so if you want to query the resources using that PowerShell cmdlet then try it out in any appropriate PowerShell prompt. Before using it, make sure the cmdlet related module is imported.

    Or in this case you could run patchinstallationresources table related command directly in your resource graph explorer.