Skip to content

Latest commit

 

History

History
219 lines (168 loc) · 5.46 KB

Get-AzResourceGroup.md

File metadata and controls

219 lines (168 loc) · 5.46 KB
external help file Module Name ms.assetid online version schema
Microsoft.Azure.PowerShell.Cmdlets.ResourceManager.dll-Help.xml
Az.Resources
5B17A241-BF36-48A6-BC29-4C32C08F5F94
2.0.0

Get-AzResourceGroup

SYNOPSIS

Gets resource groups.

SYNTAX

GetByResourceGroupName (Default)

Get-AzResourceGroup [[-Name] <String>] [[-Location] <String>] [-Tag <Hashtable>] [-ApiVersion <String>] [-Pre]
 [-DefaultProfile <IAzureContextContainer>] [-ProgressAction <ActionPreference>] [<CommonParameters>]

GetByResourceGroupId

Get-AzResourceGroup [[-Location] <String>] [-Id <String>] [-ApiVersion <String>] [-Pre]
 [-DefaultProfile <IAzureContextContainer>] [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

The Get-AzResourceGroup cmdlet gets Azure resource groups in the current subscription. You can get all resource groups, or specify a resource group by name or by other properties. By default, this cmdlet gets all resource groups in the current subscription. For more information about Azure resources and Azure resource groups, see the New-AzResourceGroup cmdlet.

EXAMPLES

Example 1: Get a resource group by name

Get-AzResourceGroup -Name "EngineerBlog"

This command gets the Azure resource group in your subscription named EngineerBlog.

Example 2: Get all tags of a resource group

(Get-AzResourceGroup -Name "ContosoRG").Tags

This command gets the resource group named ContosoRG, and displays the tags associated with that group.

Example 3: Get resource groups based on tag

Get-AzResourceGroup -Tag @{'environment'='prod'}

Example 4: Show the Resource groups by location

Get-AzResourceGroup |
  Sort-Object Location,ResourceGroupName |
    Format-Table -GroupBy Location ResourceGroupName,ProvisioningState,Tags

Example 5: Show the names of all the Resource groups in a particular location

Get-AzResourceGroup -Location westus2 |
  Sort-Object ResourceGroupName |
    Format-Wide ResourceGroupName -Column 4

Example 6: Show the Resource groups whose names begin with WebServer

Get-AzResourceGroup -Name WebServer*

PARAMETERS

-ApiVersion

Specifies the API version that is supported by the resource Provider. You can specify a different version than the default version.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure

Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
Parameter Sets: (All)
Aliases: AzContext, AzureRmContext, AzureCredential

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Id

Specifies the ID of the resource group to get. Wildcard characters are not permitted.

Type: System.String
Parameter Sets: GetByResourceGroupId
Aliases: ResourceGroupId, ResourceId

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-Location

Specifies the location of the resource group to get.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-Name

Specifies the name of the resource group to get. This parameter supports wildcards at the beginning and/or the end of the string.

Type: System.String
Parameter Sets: GetByResourceGroupName
Aliases: ResourceGroupName

Required: False
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: True

-Pre

Indicates that this cmdlet considers pre-release API versions when it automatically determines which version to use.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ProgressAction

{{ Fill ProgressAction Description }}

Type: System.Management.Automation.ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Tag

The tag hashtable to filter resource groups by.

Type: System.Collections.Hashtable
Parameter Sets: GetByResourceGroupName
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

System.String

System.Collections.Hashtable

OUTPUTS

Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels.PSResourceGroup

NOTES

RELATED LINKS

New-AzResourceGroup

Remove-AzResourceGroup

Set-AzResourceGroup