你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Get-AzContainerGroup
获取指定订阅和资源组中指定容器组的属性。 该操作返回每个容器组的属性,包括容器、映像注册表凭据、重启策略、IP 地址类型、OS 类型、状态和卷。
语法
Get-AzContainerGroup
[-SubscriptionId <String[]>]
[-DefaultProfile <PSObject>]
[<CommonParameters>]
Get-AzContainerGroup
-Name <String>
-ResourceGroupName <String>
[-SubscriptionId <String[]>]
[-DefaultProfile <PSObject>]
[<CommonParameters>]
Get-AzContainerGroup
-ResourceGroupName <String>
[-SubscriptionId <String[]>]
[-DefaultProfile <PSObject>]
[<CommonParameters>]
Get-AzContainerGroup
-InputObject <IContainerInstanceIdentity>
[-DefaultProfile <PSObject>]
[<CommonParameters>]
说明
获取指定订阅和资源组中指定容器组的属性。 该操作返回每个容器组的属性,包括容器、映像注册表凭据、重启策略、IP 地址类型、OS 类型、状态和卷。
示例
示例 1:列出当前订阅中的所有容器组
Get-AzContainerGroup
Location Name Zone ResourceGroupName
-------- ---- ---- -----------------
eastus test-cg1 test-rg
eastus test-cg2 test-rg
此命令获取当前订阅中的所有容器组。
示例 2:获取特定容器组
Get-AzContainerGroup -Name test-cg1 -ResourceGroupName test-rg | Format-List
Container : {test-container1}
DnsConfigNameServer :
DnsConfigOption :
DnsConfigSearchDomain :
EncryptionPropertyKeyName :
EncryptionPropertyKeyVersion :
EncryptionPropertyVaultBaseUrl :
IPAddressDnsNameLabel :
IPAddressFqdn :
IPAddressIP : 000.000.000.000
IPAddressPort : {Microsoft.Azure.PowerShell.Cmdlets.ContainerInsta
nce.Models.Api20210301.Port, Microsoft.Azure.Power
Shell.Cmdlets.ContainerInstance.Models.Api20210301
.Port}
IPAddressType : Public
Id : /subscriptions/00000000-0000-0000-0000-000000000000
0/resourceGroups/test-rg/providers/Microsoft.Contai
nerInstance/containerGroups/test-cg1
IdentityPrincipalId :
IdentityTenantId :
IdentityType :
IdentityUserAssignedIdentity : Microsoft.Azure.PowerShell.Cmdlets.ContainerInstan
ce.Models.Api20210301.ContainerGroupIdentityUserAs
signedIdentities
ImageRegistryCredentials :
InitContainer : {}
InstanceViewEvent :
InstanceViewState :
Location : eastus
LogAnalyticLogType :
LogAnalyticMetadata : Microsoft.Azure.PowerShell.Cmdlets.ContainerInstan
ce.Models.Api20210301.LogAnalyticsMetadata
LogAnalyticWorkspaceId :
LogAnalyticWorkspaceKey :
LogAnalyticWorkspaceResourceId : Microsoft.Azure.PowerShell.Cmdlets.ContainerInstan
ce.Models.Api20210301.LogAnalyticsWorkspaceResourc
eId
Name : test-cg1
NetworkProfileId :
OSType : Linux
ProvisioningState : Succeeded
ResourceGroupName : test-rg
RestartPolicy : Never
Sku : Standard
Tag : Microsoft.Azure.PowerShell.Cmdlets.ContainerInstan
ce.Models.Api20210301.ResourceTags
Type : Microsoft.ContainerInstance/containerGroups
Volume :
该命令获取指定的容器组。
示例 3:获取资源组中的容器组
Get-AzContainerGroup -ResourceGroupName test-rg
Location Name Zone ResourceGroupName
-------- ---- ---- -----------------
eastus test-cg1 test-rg
eastus test-cg2 test-rg
该命令获取资源组中的容器组 test-rg
。
示例 4:通过管道获取容器组
Update-AzContainerGroup -Name test-cg1 -ResourceGroupName test-rg -Tag @{"test"="value"} | Get-AzContainerGroup
Location Name Zone ResourceGroupName
-------- ---- ---- -----------------
eastus test-cg1 test-rg
该命令通过管道获取更新的容器组。
参数
-DefaultProfile
DefaultProfile 参数不起作用。 如果对其他订阅执行 cmdlet,请使用 SubscriptionId 参数。
Type: | PSObject |
Aliases: | AzureRMContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-InputObject
要构造的标识参数,请参阅 INPUTOBJECT 属性的 NOTES 部分并创建哈希表。
Type: | IContainerInstanceIdentity |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Name
容器组的名称。
Type: | String |
Aliases: | ContainerGroupName |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ResourceGroupName
资源组的名称。
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-SubscriptionId
唯一标识 Microsoft Azure 订阅的订阅凭据。 此订阅 ID 是每个服务调用的 URI 的一部分。
Type: | String[] |
Position: | Named |
Default value: | (Get-AzContext).Subscription.Id |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |