Get-AzResourceGroup
语法
GetByResourceGroupName (默认值)
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>]
说明
Get-AzResourceGroup cmdlet 获取当前订阅中的 Azure 资源组。
可以获取所有资源组,也可以按名称或其他属性指定资源组。
默认情况下,此 cmdlet 获取当前订阅中的所有资源组。
有关 Azure 资源和 Azure 资源组的详细信息,请参阅 New-AzResourceGroup cmdlet。
示例
示例 1:按名称获取资源组
Get-AzResourceGroup -Name "EngineerBlog"
此命令获取名为 EngineerBlog 的订阅中的 Azure 资源组。
示例 2:获取资源组的所有标记
(Get-AzResourceGroup -Name "ContosoRG").Tags
此命令获取名为 ContosoRG 的资源组,并显示与该组关联的标记。
示例 3:基于标记获取资源组
Get-AzResourceGroup -Tag @{'environment'='prod'}
示例 4:按位置显示资源组
Get-AzResourceGroup |
Sort-Object Location,ResourceGroupName |
Format-Table -GroupBy Location ResourceGroupName,ProvisioningState,Tags
示例 5:显示特定位置中所有资源组的名称
Get-AzResourceGroup -Location westus2 |
Sort-Object ResourceGroupName |
Format-Wide ResourceGroupName -Column 4
示例 6:显示名称以 WebServer 开头的资源组
Get-AzResourceGroup -Name WebServer*
示例 7:获取具有扩展属性的资源组
Get-AzResourceGroup -Name "ContosoRG" -ExpandProperties
参数
-ApiVersion
指定资源提供程序支持的 API 版本。
可以指定与默认版本不同的版本。
参数属性
类型: | String
|
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-DefaultProfile
用于与 azure 通信的凭据、帐户、租户和订阅
参数属性
类型: | IAzureContextContainer
|
默认值: | None |
支持通配符: | False |
不显示: | False |
别名: | AzContext, AzureRmContext, AzureCredential |
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-ExpandProperties
指定后,输出包括资源的 CreatedTime 和 ChangedTime。
参数属性
类型: | SwitchParameter
|
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-Id
指定要获取的资源组的 ID。
不允许使用通配符。
参数属性
类型: | String
|
默认值: | None |
支持通配符: | False |
不显示: | False |
别名: | ResourceGroupId, ResourceId |
参数集
GetByResourceGroupId
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
-Location
指定要获取的资源组的位置。
参数属性
类型: | String
|
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
(All)
Position: | 1 |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
-Name
指定要获取的资源组的名称。 此参数支持字符串开头和/或末尾的通配符。
参数属性
类型: | String
|
默认值: | None |
支持通配符: | True |
不显示: | False |
别名: | 资源组名称 |
参数集
GetByResourceGroupName
Position: | 0 |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
-Pre
指示此 cmdlet 在自动确定要使用的版本时会考虑预发布 API 版本。
参数属性
类型: | SwitchParameter
|
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-Tag
要按其筛选资源组的标记哈希表。
参数属性
类型: | Hashtable
|
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
GetByResourceGroupName
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
CommonParameters
此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters。
输出