Az.SearchGraph is not recognized command and I see this error

Diptesh Kumar 101 Reputation points
2024-05-15T03:18:46.6233333+00:00

Az.SearchGraph is not recognized command and I see this error

I am executing following command, so i got above error.

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" 

i am using azure powershell....

Please suggest what is the exact module, I need to install and give me exact command.

Azure Cloud Services
Azure Cloud Services
An Azure platform as a service offer that is used to deploy web and cloud applications.
652 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. vipullag-MSFT 25,041 Reputation points
    2024-05-15T04:50:59.6666667+00:00

    Hello Diptesh Kumar

    Welcome to Microsoft Q&A Platform, thanks for posting your query here.

    Based on the detaisl shared, looks like the Search-AzGraph command is not recognized because the Az.SearchGraph module is not installed.

    To install the Az.ResourceGraph module, you can use the following command:

    Install-Module -Name Az.ResourceGraph
    

    Once the module is installed, you can import it using the following command:

    Import-Module -Name Az.ResourceGraph
    

    After importing the module, you can use the Search-AzGraph command to run your query.

    Hope this helps.