< Back

Disconnect-AzureRmAccount

Tue Jan 29, 2019 9:59 pm

NAME Disconnect-AzureRmAccount



SYNOPSIS

Disconnects a connected Azure account and removes all credentials and contexts associated with that account.





SYNTAX

Disconnect-AzureRmAccount -ApplicationId <String> [-DefaultProfile <IAzureContextContainer>] [-Scope {Process | CurrentUser}] -TenantId <String>

[-Confirm] [-WhatIf] [<CommonParameters>]



Disconnect-AzureRmAccount [-AzureContext] <PSAzureContext> [-DefaultProfile <IAzureContextContainer>] [-Scope {Process | CurrentUser}] [-Confirm]

[-WhatIf] [<CommonParameters>]



Disconnect-AzureRmAccount [-ContextName <String>] [-DefaultProfile <IAzureContextContainer>] [-Scope {Process | CurrentUser}] [-Confirm] [-WhatIf]

[<CommonParameters>]



Disconnect-AzureRmAccount [-InputObject] <PSAzureRmAccount> [-DefaultProfile <IAzureContextContainer>] [-Scope {Process | CurrentUser}] [-Confirm]

[-WhatIf] [<CommonParameters>]



Disconnect-AzureRmAccount [-Username] <String> [-DefaultProfile <IAzureContextContainer>] [-Scope {Process | CurrentUser}] [-Confirm] [-WhatIf]

[<CommonParameters>]





DESCRIPTION

The Disconnect-AzureRmAccount cmdlet disconnects a connected Azure account and removes all credentials and contexts (subscription and tenant

information) associated with that account.



After executing this cmdlet, you will need to login again using Connect-AzureRmAccount.





PARAMETERS

-ApplicationId <String>

ServicePrincipal id (globally unique id)



Required? true

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-AzureContext <PSAzureContext>

Context



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByValue)

Accept wildcard characters? false



-ContextName <String>

Name of the context to log out of



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-DefaultProfile <IAzureContextContainer>

The credentials, tenant and subscription used for communication with azure



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-InputObject <PSAzureRmAccount>

The account object to remove



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByValue)

Accept wildcard characters? false



-Scope <ContextModificationScope>

Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this

user.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-TenantId <String>

Tenant id (globally unique id)



Required? true

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Username <String>

User name of the form 'user@contoso.org'



Required? true

Position? 0

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Confirm [<SwitchParameter>]

Prompts you for confirmation before running the cmdlet.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

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



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, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

Microsoft.Azure.Commands.Profile.Models.PSAzureRmAccount





Microsoft.Azure.Commands.Profile.Models.PSAzureContext







OUTPUTS

Microsoft.Azure.Commands.Profile.Models.PSAzureRmAccount







NOTES









Logout of the current account



PS C:\\> Disconnect-AzureRmAccount



Logs out of the Azure account associated with the current context.





Logout of the account associated with a particular context



PS C:\\> Get-AzureRmContext "Work" | Disconnect-AzureRmAccount -Scope CurrentUser



Logs out the account associated with the given context (named 'Work'). Because this uses the 'CurrentUser' scope, all credentials and contexts

will be permanently deleted.





Log out a particular user



PS C:\\> Disconnect-AzureRmAccount -Username 'user1@contoso.org'



Logs out the 'user1@contoso.org' user - all credentials and all contexts associated with this user will be removed.







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... ermaccount