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.