Remove-AzureAccount
從 Windows PowerShell 刪除 Azure 帳戶。
注意
本檔中參考的 Cmdlet 用於管理使用服務管理 API 的舊版 Azure 資源。 如需管理 Azure Resource Manager 資源的 Cmdlet,請參閱 Az PowerShell 模組 。
Syntax
Remove-AzureAccount
-Name <String>
[-Force]
[-PassThru]
[-Profile <AzureSMProfile>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Remove-AzureAccount Cmdlet 會從漫遊使用者設定檔中的訂用帳戶資料檔案中刪除 Azure 帳戶及其訂用帳戶。 它不會從 Microsoft Azure 刪除帳戶,或以任何方式變更實際帳戶。
使用此 Cmdlet 非常類似于登出您的 Azure 帳戶。 而且,如果您想要再次登入帳戶,請使用 Add-AzureAccount 或 Import-AzurePublishSettingsFile 再次將帳戶新增至 Windows PowerShell。
您也可以使用 Remove-AzureAccount Cmdlet 來變更 Azure PowerShell Cmdlet 登入 Azure 帳戶的方式。 如果您的帳戶同時具有 Import-AzurePublishSettingsFile 的管理憑證和 Add-AzureAccount 的存取權杖 ,Azure PowerShell Cmdlet 只會使用存取權杖;它們會忽略管理憑證。 若要使用管理憑證,請執行 Remove-AzureAccount 。 當 Remove-AzureAccount 同時找到管理憑證和存取權杖時 ,只會刪除存取權杖,而不是刪除帳戶。 管理憑證仍然存在,因此帳戶仍可供 Windows PowerShell 使用。
本主題描述 Microsoft Azure PowerShell 模組 0.8.10 版中的 Cmdlet。
若要取得您所使用的模組版本,請在 Azure PowerShell 主控台中輸入 (Get-Module -Name Azure).Version
。
範例
範例 1:移除帳戶
PS C:\> Remove-AzureAccount -Name admin@contoso.com
此命令會 admin@contoso.com 從您的訂用帳戶資料檔案中移除 。 當命令完成時,Windows PowerShell 就無法再使用帳戶。
參數
-Confirm
執行 Cmdlet 之前先提示您確認。
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Force
隱藏確認提示。 根據預設, Remove-AzureAccount 會在從 Windows PowerShell 移除帳戶之前提示您。
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Name
指定要移除的帳戶名稱。 參數值會區分大小寫。 不支援萬用字元。
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-PassThru
如果命令成功,並$False失敗,則傳回$True。 根據預設,此 Cmdlet 不會傳回任何輸出。
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Profile
指定此 Cmdlet 從中讀取的 Azure 設定檔。 如果您未指定設定檔,此 Cmdlet 會從本機預設設定檔讀取。
Type: | AzureSMProfile |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-WhatIf
顯示執行 Cmdlet 後會發生的情況。 未執行 Cmdlet。
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
輸入
None
您可以透過屬性名稱將輸入管線傳送至此 Cmdlet,但不能依值傳送。
輸出
None or System.Boolean
如果您使用 PassThru 參數,此 Cmdlet 會傳回布林值。 否則,它不會傳回任何輸出。