Use the Disconnect-AzAccount cmdlet when you're finished. Or put that cmdlet into your PowerShell profile so it disconnects you every time you start PowerShell. Or put it into PowerShell script that runs when you log out of your widows session or shut down your machine.
How to ensure to be prompted for credentials every time I run Connect-AzAccount in PS
Alex Toniati
121
Reputation points
Hi all,
How can I force powershell to ask me to input username and credential everytime that I run 'connect-azaccount' command?
I mean, if I log on azure using powershell then close, even after some days, I run the command 'connect-azaccount' again and is prompted to choose between 'Pick my previous/recents account' and 'Use another account'.
Thats the point, I need to be directly asked for the username and password and not to pick recents accounts.
Is there any solution for this case?
Thanks in advance
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,954 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
24,674 questions