In this article, we will discuss how to get all Resource Groups in a subscription using PowerShell, and it’s never a big task. You need to use the Get-AzResourceGroup Azure PowerShell cmdlet. Let’s discuss a few words on how to use Get-AzResourceGroup and the use of Get-AzResourceGroup Azure PowerShell to list Resource Groups.
Table of Contents
Get-AzResourceGroup
An excellent Azure PowerShell cmdlet to retrieve the Resource Groups.
Syntax of Get-AzResourceGroup:
Get-AzResourceGroup [[-Name] <String>] [[-Location] <String>] And,
Get-AzResourceGroup [[-Location] <String>] [-Id <String>]After executing the Get-AzResourceGroup Azure PowerShell cmdlet, there is a chance you might get an error. You can check out the below article to fix the same issue.
Related article: The ‘Get-AzResourceGroup’ command was found in the module ‘Az.Resources’
Let’s check out some examples.
Get-AzResourceGroup Examples:
Example-1: Below cmdlet will get you a list of all the resource Groups available.
Get-AzResourceGroupAfter executing the above Azure PowerShell cmdlet, I got the below output.
PS C:\WINDOWS\system32> Get-AzResourceGroup
ResourceGroupName : NetworkWatcherRG
Location : eastus
ProvisioningState : Succeeded
Tags :
ResourceId : /subscriptions/1cdf4300-dee5-3498-9c9c-feaa72a5cbd1/resourceGroups
/NetworkWatcherRG
ResourceGroupName : Default-Storage-SouthCentralUS
Location : southcentralus
ProvisioningState : Succeeded
Tags :
ResourceId : /subscriptions/1cdf4300-dee5-3498-9c9c-feaa72a5cbd1/resourceGroups
/Default-Storage-SouthCentralUS
ResourceGroupName : MyNewresgroupupdt
Location : centralus
ProvisioningState : Succeeded
Tags :
Name Value
====== =======
Status Startup
TSINFO IT
ResourceId : /subscriptions/1cdf4300-dee5-3498-9c9c-feaa72a5cbd1/resourceGroups
/MyNewresgroupupdt
ResourceGroupName : mynewfunctionapp235
Location : centralus
ProvisioningState : Succeeded
Tags :
ResourceId : /subscriptions/1cdf4300-dee5-3498-9c9c-feaa72a5cbd1/resourceGroups
/mynewfunctionapp235
ResourceGroupName : myjavascriptazurefunctio
Location : centralus
ProvisioningState : Succeeded
Tags :
ResourceId : /subscriptions/1cdf4300-dee5-3498-9c9c-feaa72a5cbd1/resourceGroups
/myjavascriptazurefunction
ResourceGroupName : mynewazurefunctionapp25
Location : centralus
ProvisioningState : Succeeded
Tags :
ResourceId : /subscriptions/1cdf4300-dee5-3498-9c9c-feaa72a5cbd1/resourceGroups
/mynewazurefunctionapp25
ResourceGroupName : MyNewResGrp
Location : centralus
ProvisioningState : Succeeded
Tags :
ResourceId : /subscriptions/1cdf4300-dee5-3498-9c9c-feaa72a5cbd1/resourceGroups
/MyNewResGrp
ResourceGroupName : DefaultResourceGroup-CUS
Location : centralus
ProvisioningState : Succeeded
Tags :
ResourceId : /subscriptions/1cdf4300-dee5-3498-9c9c-feaa72a5cbd1/resourceGroups
/DefaultResourceGroup-CUS
ResourceGroupName : newresgroup-260369671
Location : eastus
ProvisioningState : Succeeded
Tags :
ResourceId : /subscriptions/1cdf4300-dee5-3498-9c9c-feaa72a5cbd1/resourceGroups
/newresgroup-260369671
ResourceGroupName : newresgroup-1443124578
Location : eastus
ProvisioningState : Succeeded
Tags :
ResourceId : /subscriptions/1cdf4300-dee5-3498-9c9c-feaa72a5cbd1/resourceGroups
/newresgroup-1443124578
ResourceGroupName : mynewupdatedazurefnapp
Location : eastus
ProvisioningState : Succeeded
Tags :
ResourceId : /subscriptions/1cdf4300-dee5-3498-9c9c-feaa72a5cbd1/resourceGroups
/mynewupdatedazurefnapp
ResourceGroupName : Demo123
Location : eastus
ProvisioningState : Succeeded
Tags :
ResourceId : /subscriptions/1cdf4300-dee5-3498-9c9c-feaa72a5cbd1/resourceGroups
/Demo123
ResourceGroupName : DemoVM1
Location : eastus
ProvisioningState : Succeeded
Tags :
ResourceId : /subscriptions/1cdf4300-dee5-3498-9c9c-feaa72a5cbd1/resourceGroups
/DemoVM1
ResourceGroupName : DemoVM2
Location : eastus
ProvisioningState : Succeeded
Tags :
ResourceId : /subscriptions/1cdf4300-dee5-3498-9c9c-feaa72a5cbd1/resourceGroups
/DemoVM2
ResourceGroupName : mypythondemoapp1
Location : eastus
ProvisioningState : Succeeded
Tags :
ResourceId : /subscriptions/1cdf4300-dee5-3498-9c9c-feaa72a5cbd1/resourceGroups
/mypythondemoapp1
ResourceGroupName : mynewresgrp1
Location : eastus
ProvisioningState : Succeeded
Tags :
ResourceId : /subscriptions/1cdf4300-dee5-3498-9c9c-feaa72a5cbd1/resourceGroups
/mynewresgrp1
ResourceGroupName : demoRsgGroup
Location : eastus
ProvisioningState : Succeeded
Tags :
ResourceId : /subscriptions/1cdf4300-dee5-3498-9c9c-feaa72a5cbd1/resourceGroups
/demoRsgGroupYou can see it here

Example 2: Below cmdlet will get you the details of the Resource Group named Demo123.
Get-AzResourceGroup -Name "demo358"After executing the above Azure PowerShell cmdlet, I got the below output.
ResourceGroupName : demo358
Location : centralus
ProvisioningState : Succeeded
Tags :
ResourceId : /subscriptions/1cdf4300-dee5-4518-9c9c-feaa72a5cbd1/resourceGroups/demo358You can also check out the same output in the screenshot below

Example-3: Below cmdlet will get all the resource groups from the centralus region.
Get-AzResourceGroup -Location centralus
The output will be like this with all the resource groups from the centralus region.
ResourceGroupName : demo358
Location : centralus
ProvisioningState : Succeeded
Tags :
ResourceId : /subscriptions/1cdf4300-dee5-4518-9c9c-feaa72a5cbd1/resourceGroups/demo358
ResourceGroupName : Demo12346
Location : centralus
ProvisioningState : Succeeded
Tags :
ResourceId : /subscriptions/1cdf4300-dee5-4518-9c9c-feaa72a5cbd1/resourceGroups/Demo12346
You can see the same output in the screenshot below

Example-4: Below, the cmdlet will get you the lists of resource groups whose name starts with Demo.
Get-AzResourceGroup -Name Demo*After executing the above Azure PowerShell cmdlet, I got the below output.
ResourceGroupName : demo357
Location : centralus
ProvisioningState : Succeeded
Tags :
ResourceId : /subscriptions/1cdf4300-dee5-4518-9c9c-feaa72a5cbd1/resourceGroups/demo357
ResourceGroupName : demo358
Location : centralus
ProvisioningState : Succeeded
Tags :
ResourceId : /subscriptions/1cdf4300-dee5-4518-9c9c-feaa72a5cbd1/resourceGroups/demo358
ResourceGroupName : Demo12346
Location : centralus
ProvisioningState : Succeeded
Tags :
ResourceId : /subscriptions/1cdf4300-dee5-4518-9c9c-feaa72a5cbd1/resourceGroups/Demo12346
ResourceGroupName : demoRsgGroup
Location : eastus
ProvisioningState : Succeeded
Tags :
ResourceId : /subscriptions/1cdf4300-dee5-4518-9c9c-feaa72a5cbd1/resourceGroups/demoRsgGroupYou can see the same output in the screenshot below

You may also like following the articles below
- New-AzResourceGroup: A positional parameter cannot be found that accepts argument
- The term ‘New-AzResourceGroup’ is not recognized as the name of a cmdlet
Wrapping Up
In this article, we learned how to list Resource Groups in Azure using Powershell and the syntax and usage of Get-AzResourceGroup Azure PowerShell cmdlet with examples.

I am Rajkishore, and I am a Microsoft Certified IT Consultant. I have over 14 years of experience in Microsoft Azure and AWS, with good experience in Azure Functions, Storage, Virtual Machines, Logic Apps, PowerShell Commands, CLI Commands, Machine Learning, AI, Azure Cognitive Services, DevOps, etc. Not only that, I do have good real-time experience in designing and developing cloud-native data integrations on Azure or AWS, etc. I hope you will learn from these practical Azure tutorials. Read more.
