Remove-AzureAccount

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Remove-AzureAccount

Deletes an Azure account from Windows PowerShell.

Syntax

Parameter Set: Default
Remove-AzureAccount [-Name] <String> [[-Force]] [[-PassThru]] [-SubscriptionDataFile <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Detailed Description

The Remove-AzureAccount cmdlet deletes an Azure account from your subscription data file and deletes the management certificate or access token that allows Windows PowerShell to access your account on your behalf. This cmdlet does not delete the account from Microsoft Azure, or change the actual account in any way.

Using this cmdlet is a lot like logging out of your Azure account. And, if you want to log into the account again, use the Add-AzureAccount or Import-AzurePublishSettingsFile to add the account to Windows PowerShell again.

You can also use Remove-AzureAccount cmdlet to change the way the Azure PowerShell cmdlets sign into your Azure account. If your account has both a management certificate from Import-AzurePublishSettingsFile and an access token from Add-AzureAccount, the Azure PowerShell cmdlets use only the access token; they ignore the management certificate. To use the management certificate, run Remove-AzureAccount. When Remove-AzureAccount finds both a management certificate and an access token, it deletes only the access token, instead of deleting the account. The management certificate is still there, so account is still available to Windows PowerShell.

This topic describes the cmdlet in the 0.8.1 version of the Microsoft Azure PowerShell module. To find out the version of the module you're using, from the Azure PowerShell console, type (get-module azure).version.

Parameters

-Force

Suppresses the confirmation prompt. By default, Remove-AzureAccount prompts you before deleting the account from Windows PowerShell.

Aliases

none

Required?

false

Position?

3

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Name<String>

Specifies the name of the account to remove. The parameter value is case-sensitive. Wildcard characters are not supported.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-PassThru

Returns True ($true) if the operation succeeded and False ($false) if it failed. By default, the cmdlet does not return any output.

Aliases

none

Required?

false

Position?

4

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SubscriptionDataFile<String>

Specifies the path and filename of an alternate subscription data file. This parameter is optional. By default, Get-AzureAccount gets account and subscription information from the default subscription data file in your roaming user profile. Use this parameter if you used the SubscriptionDataFile parameter in Add-AzureAccount or Import-AzurePublishSettingsFile to specify an alternate (non-default) file.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before running the cmdlet.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see  about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • None

    You can pipe input to this cmdlet by property name, but not by value.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • None or System.Boolean

    If you use the PassThru parameter, this cmdlet returns a Boolean value. Otherwise, it does not return any output.

Examples

Example 1: Delete an account

This command deletes the admin@contoso.com from your subscription data file. When the command completes, the account is no longer available to Windows PowerShell.

PS C:\> Remove-AzureAccount -Name admin@contoso.com

Add-AzureAccount

Get-AzureAccount