共用方式為


Disconnect-AzAccount

中斷連線的 Azure 帳戶,並移除與該帳戶相關聯的所有認證和內容。

語法

Disconnect-AzAccount
          [-ContextName <String>]
          [-Scope <ContextModificationScope>]
          [-DefaultProfile <IAzureContextContainer>]
          [-WhatIf]
          [-Confirm]
          [<CommonParameters>]
Disconnect-AzAccount
          [-Username] <String>
          [-Scope <ContextModificationScope>]
          [-DefaultProfile <IAzureContextContainer>]
          [-WhatIf]
          [-Confirm]
          [<CommonParameters>]
Disconnect-AzAccount
          -ApplicationId <String>
          -TenantId <String>
          [-Scope <ContextModificationScope>]
          [-DefaultProfile <IAzureContextContainer>]
          [-WhatIf]
          [-Confirm]
          [<CommonParameters>]
Disconnect-AzAccount
          [-InputObject] <PSAzureRmAccount>
          [-Scope <ContextModificationScope>]
          [-DefaultProfile <IAzureContextContainer>]
          [-WhatIf]
          [-Confirm]
          [<CommonParameters>]
Disconnect-AzAccount
          [-AzureContext] <PSAzureContext>
          [-Scope <ContextModificationScope>]
          [-DefaultProfile <IAzureContextContainer>]
          [-WhatIf]
          [-Confirm]
          [<CommonParameters>]

Description

Disconnect-AzAccount Cmdlet 會中斷連線的 Azure 帳戶,並移除與該帳戶相關聯的所有認證和內容(訂用帳戶和租用戶資訊)。 執行此 Cmdlet 之後,您必須使用 連線-AzAccount 再次登入。

範例

範例 1:註銷目前帳戶

Disconnect-AzAccount

註銷與目前內容相關聯的 Azure 帳戶。

範例 2:註銷與特定內容相關聯的帳戶

Get-AzContext "Work" | Disconnect-AzAccount -Scope CurrentUser

註銷與指定內容相關聯的帳戶(名為 'Work')。 由於這會使用 『CurrentUser』 範圍,因此將會永久刪除所有認證和內容。

範例 3:註銷特定使用者

Disconnect-AzAccount -Username 'user1@contoso.org'

註銷 『user1@contoso.org' 使用者 - 將會移除與此使用者相關聯的所有認證和所有內容。

參數

-ApplicationId

ServicePrincipal id (全域唯一標識符)

類型:String
別名:SPN, ServicePrincipal
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-AzureContext

上下文

類型:PSAzureContext
Position:0
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-Confirm

執行 Cmdlet 之前先提示您確認。

類型:SwitchParameter
別名:cf
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-ContextName

要註銷的內容名稱

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-DefaultProfile

用於與 azure 通訊的認證、租用戶和訂用帳戶

類型:IAzureContextContainer
別名:AzContext, AzureRmContext, AzureCredential
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-InputObject

要移除的帳戶物件

類型:PSAzureRmAccount
Position:0
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-Scope

判斷內容變更的範圍,例如,變更僅適用於目前進程,或套用至此用戶啟動的所有會話。

類型:ContextModificationScope
接受的值:Process, CurrentUser
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-TenantId

租使用者識別碼 (全域唯一標識符)

類型:String
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-Username

表單 'user@contoso.org' 的用戶名稱

類型:String
別名:Id, UserId
Position:0
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-WhatIf

顯示執行 Cmdlet 後會發生的情況。 不會執行 Cmdlet。

類型:SwitchParameter
別名:wi
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

輸入

PSAzureRmAccount

PSAzureContext

輸出

PSAzureRmAccount