共用方式為


Get-AzContainerGroup

取得指定訂用帳戶和資源群組中指定容器群組的屬性。 此作業會傳回每個容器群組的屬性,包括容器、映像登錄認證、重新啟動原則、IP 位址類型、OS 類型、狀態和磁碟區。

語法

List (預設值)

Get-AzContainerGroup
    [-SubscriptionId <String[]>]
    [-DefaultProfile <PSObject>]
    [<CommonParameters>]

Get

Get-AzContainerGroup
    -Name <String>
    -ResourceGroupName <String>
    [-SubscriptionId <String[]>]
    [-DefaultProfile <PSObject>]
    [<CommonParameters>]

List1

Get-AzContainerGroup
    -ResourceGroupName <String>
    [-SubscriptionId <String[]>]
    [-DefaultProfile <PSObject>]
    [<CommonParameters>]

GetViaIdentity

Get-AzContainerGroup
    -InputObject <IContainerInstanceIdentity>
    [-DefaultProfile <PSObject>]
    [<CommonParameters>]

Description

取得指定訂用帳戶和資源群組中指定容器群組的屬性。 此作業會傳回每個容器群組的屬性,包括容器、映像登錄認證、重新啟動原則、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 參數。

參數屬性

類型:PSObject
預設值:None
支援萬用字元:False
不要顯示:False
別名:AzureRMContext, AzureCredential

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-InputObject

Identity Parameter To construct, see NOTES section for INPUTOBJECT properties and create a hash table.

參數屬性

類型:IContainerInstanceIdentity
預設值:None
支援萬用字元:False
不要顯示:False

參數集

GetViaIdentity
Position:Named
必要:True
來自管線的值:True
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-Name

容器群組的名稱。

參數屬性

類型:String
預設值:None
支援萬用字元:False
不要顯示:False
別名:容器組名稱

參數集

Get
Position:Named
必要:True
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-ResourceGroupName

資源群組的名稱。 名稱不區分大小寫。

參數屬性

類型:String
預設值:None
支援萬用字元:False
不要顯示:False

參數集

Get
Position:Named
必要:True
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False
List1
Position:Named
必要:True
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-SubscriptionId

目標訂用帳戶的標識碼。 此值必須是 UUID。

參數屬性

類型:

String[]

預設值:(Get-AzContext).Subscription.Id
支援萬用字元:False
不要顯示:False

參數集

List
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False
Get
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False
List1
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

CommonParameters

此 cmdlet 支援常見參數:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 如需詳細資訊,請參閱 about_CommonParameters

輸入

IContainerInstanceIdentity

輸出

IContainerGroup