search graph query not able to recogniz

Diptesh Kumar 101 Reputation points
2024-05-18T06:42:58.98+00:00

Even az resource gaph module is already there it is giving error as below

'Search-AzGraph' is not recognized as an internal or external command

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,947 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Marilee Turscak-MSFT 35,116 Reputation points Microsoft Employee
    2024-05-21T23:40:58.9666667+00:00

    Hi @Diptesh Kumar

    In order to use this command, you need to make sure that you are connected to a valid Azure subscription and Azure CLI needs to be installed using an admin Powershell instance.

    If Azure CLI is not already installed, in an admin PowerShell instance run:

    Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile .\AzureCLI.msi; 
    

    Make sure that the resource Graph module is installed:

    Install-Module -Name Az.ResourceGraph -Repository PSGallery -Scope CurrentUser
    
    

    Then connect to Azure. If you have more than one subscription, run the commands to set context to your subscription. Replace <subscriptionID> with your Azure subscription ID.

    Connect-AzAccount
    
    
    

    The syntax for Search-AzGraph is this:

    Search-AzGraph -Query 'Resources | project name, type | limit 5'
    
    

    https://learn.microsoft.com/en-us/azure/governance/resource-graph/first-query-powershell

    Let me know if you still face this issue and feel free to share the full command and output if you still run into this.

    If the information helped you, please Accept the answer. This will help us as well as others in the community who may be researching similar questions.

    0 comments No comments