Using Azure Graph Search via Azure CLI

Azure graph search is a search that you can do from the azure cli. Normal you cant just directly do it you have to install the extension for the azure graph. To do that you have to open the CLI and add the extension.

>az extension add – – name resource-graph

This will add the resource graph extension to the azure cli

You can view the list of the extension by using this command.

>az extension list

After that you are ready to take the advantage of the graph query there are many command you can run you can find them by running

>azure graph query -h

To list down all the projects run this command

you can view whats under a certain subscription by running this command

  • az graph query -q “project id” -s “subscriptionid”

this will give you a json presentation of the output if you want to have a more readable output you need to pass the table output paramegter.

  • Az graph query -q “project id, name” -o table

If you want to add another command in the query you have to pipe the command the easest example is to sort the ourput so run this command

  • Az graph query -q “project id,name | order by name” -o table