Movatterモバイル変換


[0]ホーム

URL:


Skip to main contentSkip to in-page navigation

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit editor mode

Get-AzResourceGroup

    Gets resource groups.

    Syntax

    GetByResourceGroupName (Default)

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

    GetByResourceGroupId

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

    Description

    TheGet-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*

    Example 7: Get a resource group with expanded properties

    Get-AzResourceGroup -Name "ContosoRG" -ExpandProperties

    Parameters

    -ApiVersion

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

    Parameter properties

    Type:String
    Default value:None
    Supports wildcards:False
    DontShow:False

    Parameter sets

    (All)
    Position:Named
    Mandatory:False
    Value from pipeline:False
    Value from pipeline by property name:False
    Value from remaining arguments:False

    -DefaultProfile

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

    Parameter properties

    Type:IAzureContextContainer
    Default value:None
    Supports wildcards:False
    DontShow:False
    Aliases:AzContext, AzureRmContext, AzureCredential

    Parameter sets

    (All)
    Position:Named
    Mandatory:False
    Value from pipeline:False
    Value from pipeline by property name:False
    Value from remaining arguments:False

    -ExpandProperties

    When specified, output includes CreatedTime and ChangedTime of a resource.

    Parameter properties

    Type:SwitchParameter
    Default value:None
    Supports wildcards:False
    DontShow:False

    Parameter sets

    (All)
    Position:Named
    Mandatory:False
    Value from pipeline:False
    Value from pipeline by property name:False
    Value from remaining arguments:False

    -Id

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

    Parameter properties

    Type:String
    Default value:None
    Supports wildcards:False
    DontShow:False
    Aliases:ResourceGroupId, ResourceId

    Parameter sets

    GetByResourceGroupId
    Position:Named
    Mandatory:False
    Value from pipeline:False
    Value from pipeline by property name:True
    Value from remaining arguments:False

    -Location

    Specifies the location of the resource group to get.

    Parameter properties

    Type:String
    Default value:None
    Supports wildcards:False
    DontShow:False

    Parameter sets

    (All)
    Position:1
    Mandatory:False
    Value from pipeline:False
    Value from pipeline by property name:True
    Value from remaining arguments: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.

    Parameter properties

    Type:String
    Default value:None
    Supports wildcards:True
    DontShow:False
    Aliases:ResourceGroupName

    Parameter sets

    GetByResourceGroupName
    Position:0
    Mandatory:False
    Value from pipeline:False
    Value from pipeline by property name:True
    Value from remaining arguments:False

    -Pre

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

    Parameter properties

    Type:SwitchParameter
    Default value:None
    Supports wildcards:False
    DontShow:False

    Parameter sets

    (All)
    Position:Named
    Mandatory:False
    Value from pipeline:False
    Value from pipeline by property name:False
    Value from remaining arguments:False

    -Tag

    The tag hashtable to filter resource groups by.

    Parameter properties

    Type:Hashtable
    Default value:None
    Supports wildcards:False
    DontShow:False

    Parameter sets

    GetByResourceGroupName
    Position:Named
    Mandatory:False
    Value from pipeline:False
    Value from pipeline by property name:True
    Value from remaining arguments:False

    CommonParameters

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

    Inputs

    String

    Hashtable

    Outputs

    PSResourceGroup

    Related Links

    Collaborate with us on GitHub
    The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, seeour contributor guide.

    Feedback

    Was this page helpful?

    YesNoNo

    Need help with this topic?

    Want to try using Ask Learn to clarify or guide you through this topic?

    Suggest a fix?

    In this article

    Was this page helpful?

    YesNo
    NoNeed help with this topic?

    Want to try using Ask Learn to clarify or guide you through this topic?

    Suggest a fix?