Get-AzResourceGroup

In this article, we will discuss how to get lists of Resource Groups 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 cmdlet.

Get-AzResourceGroup

An excellent Azure PowerShell cmdlet to retrieve the Resource Groups.

Syntax:

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.

Examples:

Example-1: Below cmdlet will get you a list of all the resource Groups available.

Get-AzResourceGroup

After 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
                    /demoRsgGroup

ResourceGroupName : TSinfoWebRole
Location          : eastus
ProvisioningState : Succeeded
Tags              : 
ResourceId        : /subscriptions/1cdf4300-dee5-3498-9c9c-feaa72a5cbd1/resourceGroups
                    /TSinfoWebRole

ResourceGroupName : newresgroup
Location          : centralus
ProvisioningState : Succeeded
Tags              : 
ResourceId        : /subscriptions/1cdf4300-dee5-3498-9c9c-feaa72a5cbd1/resourceGroups
                    /newresgroup

You can see it here

Azure PowerShell List Resource Groups

Example 2: Below cmdlet will get you the details of the Resource Group named Demo123.

Get-AzResourceGroup -Name "Demo123"

After executing the above Azure PowerShell cmdlet, I got the below output.

ResourceGroupName : Demo123
Location          : eastus
ProvisioningState : Succeeded
Tags              : 
ResourceId        : /subscriptions/1cdf4300-dee5-3498-9c9c-feaa72a5cbd1/resourceGroups
                    /Demo123

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 : deletelistresourcegroup
Location          : centralus
ProvisioningState : Succeeded
Tags              : 
ResourceId        : /subscriptions/1cdf4300-dee5-3498-9c9c-feaa72a5cbd1/resourceGroups
                    /deletelistresourcegroup

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 : Demo87
Location          : eastus
ProvisioningState : Succeeded
Tags              : 
ResourceId        : /subscriptions/1cdf4300-dee5-4518-9c9c-feaa72a5cbd1/resourceGroups
                    /Demo87

ResourceGroupName : Demo690
Location          : eastus
ProvisioningState : Succeeded
Tags              : 
ResourceId        : /subscriptions/1cdf4300-dee5-4518-9c9c-feaa72a5cbd1/resourceGroups
                    /Demo690

You may also like following the articles below

Wrapping Up

In this article, we learned how to get Resource Groups using PowerShell and the syntax and usage of Get-AzResourceGroup Azure PowerShell cmdlet with examples.