Cmdlets

Choose a cmdlet from the list on the left or search for a specific cmdlet. Choose a cmdlet from the list or search for a specific cmdlet.
About Help  Providers
 

Get-AzureResourceGroup

Get-AzureResourceGroup

microsoft.azure.commands.resources.dll

Synopsis

Gets Azure resource groups

Syntax

Get-AzureResourceGroup [-Name] [<CommonParameters>]

Get-AzureResourceGroup [-Tag] [-Detailed] [<CommonParameters>]

Detailed Description

The Get-AzureResourceGroup cmdlet gets the Azure resource groups in your subscription. You can use the Name parameter to select resource groups by name. The default is all resource groups.An Azure resource is a user-managed Azure entity, such as a database server, database, or web site. An Azure resource group is a collection of Azure resources that are deployed as a unit.

Parameters

-Name <String>

Specifies the name of the resource group. Wildcards are not permitted. This parameter is optional. The default is all resource groups in the subscription

Aliases

None

Required?

true

Position

0

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-Tag <Hashtable>

Gets resource groups that have the specified Azure tags. Enter a hash table with a Name key or Name and Value keys. Wildcard characters are not supported.A "tag" is a name-value pair that you can apply to resources and resource groups. Use tags to categorize your resources, such as by department or cost center, or to track notes or comments about the resources. To add a tag to a resource group, use the Tag parameter of the New-AzureResourceGroup or Set-AzureResourceGroup cmdlets. To create a predefined tag, use the New-AzureTag cmdlet.For help with hash tables in Windows PowerShell, type: Get-Help about_Hashtables.

Aliases

None

Required?

false

Position

0

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-Detailed <SwitchParameter>

Return the details of each resource group if specified.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

Input Type

None

Return Type

Microsoft.Azure.Commands.ResourceManagement.PSResourceGroup

Notes

The Get-AzureResourceGroup cmdlet is included in the Azure Resource Manager module beginning in module version 0.8.0.

Examples

-------------------------- Example 1: Get all resource groups and their details --------------------------

This command gets all resource groups in the subscription.

PS C:\>Get-AzureResourceGroup -Detailed
Name:      Contoso
Location:  West US
Resources: 
           Name             Type                     Location
           ===============  =======================  ========
           ConstosoWebSite  Microsoft.Web/sites      West US
           sqlsvr03         Microsoft.Sql/servers    West US
           sqldb01          Microsoft.Sql/databases  West US

Name:      EngineerBlog
Location:  East US
Resources: 
           Name             Type                     Location
           ===============  =======================  ========
           EngineerBlog     Microsoft.Web/sites      West US
           EngSvr01         Microsoft.Sql/servers    West US
           EngDB02          Microsoft.Sql/databases  West US

-------------------------- Example 2: Get resource groups by name --------------------------

This command gets Azure resource groups in your subscription that have names that begin with "eng".

PS C:\>Get-AzureResourceGroup -Name EngineerBlog
Name:      EngineerBlog
Location:  East US
Resources: 
           Name             Type                     Location
           ===============  =======================  ========
           EngineerBlog     Microsoft.Web/sites      West US
           EngSvr01         Microsoft.Sql/servers    West US
           EngDB02          Microsoft.Sql/databases  West US

-------------------------- Example 3: Get resource groups by other properties --------------------------

The command uses the Where-Object, ForEach-Object, and Select-Object cmdlets to get the names of resource groups that include Azure database server farms. You can use commands like this one to find resource groups with resources or properties of interest.

PS C:\>Get-AzureResourceGroup -Detailed | Where-Object {$_.Resources.Type -like "*serverFarms*"} | Select-Object -Property ResourceGroupName
Contoso
EngineerBlog

-------------------------- Example 4: Get resource groups by tag --------------------------

These commands get resource groups by tag. The first command gets resource groups that have a "CostCenter" tag with a value of "Development". The second command gets all resource groups that have a "CostCenter" tag, regardless of its value.

PS C:\>Get-AzureResourceGroup -Tag @{Name="CostCenter";Value="Development"}

PS C:\>Get-AzureResourceGroup -Tag @{Name="CostCenter"}

-------------------------- Example 5: Get all tags of a resource group --------------------------

These commands get all tags of the ContosoRG resource group. The first command gets the resource group by name with all of its properties. The second command, which uses the Tags property of the output object, gets only the tags.

PS C:\>Get-AzureResourceGroup -Name ContosoRG

PS C:\>(Get-AzureResourceGroup -Name ContosoRG).Tags

Tags: 

      Name        Value
      ====        ======
      Department  IT
      Status      Approved
      FY2016

Online Version
New-AzureResourceGroup
Remove-AzureResourceGroup