To get all the Azure resource groups connected to the particular subscription use the az group command.
Before using this command make sure you are connected with the Azure account and if not connect the azure account with the “Az login”
Once you are connected to the Azure account, set the subscription name for which you want to retrieve the resource groups.
az account set --subscription 'subscription name or id'
Once you have set the subscription, use the below command to retrieve all the resource groups.
PS C:\> az group list -otable
To get the particular resource group details, use the below command.
PS C:\> az group show -n resourcegroupname
The above command output is in JSON format. To get the output in the table format, use the below command.
PS C:\> az group show -n ResourceGroupName -otable
To search for the specific resource group using CLI, we need to use the JMESPATH query as shown below
PS C:\> az group list --query "[?name=='AzRG']" -otable
The above command will find the resource group name ‘AzRG’ from the list.