How to switch accounts via VS Code Azure Account Extension
AzureVisual Studio-CodeAzure Problem Overview
I've signed into one of my Azure accounts with Azure Account Extension via VS Code. I didn't find any button to sign out or switch accounts. How do I sign out or switch accounts?
Azure Solutions
Solution 1 - Azure
There is no button that you can find to sign in or sign out in VS Code with Azure Account Extension. The extension works with commands from Command Palette.
In VS Code press Ctrl+Shift+p to see the command palette and write the symbol >
, after that you can see any command you need including the sign out
command to work with this extension.
Solution 2 - Azure
Use the shortcut Ctrl + Shift + P to bring up VS Code command palette
In the command palette prompt that appears type:
Azure: Sign Out
Solution 3 - Azure
The shortest way to achieve this in vscode is by pressing F1
to show the command pallet and then type azso
(Azure Sign Out), first letter of each word, and press enter.
Note that this "first letter of each word" also works with other commands, very handy if you're a keyboard/shortcut person.
Solution 4 - Azure
I had the same issue that I resolved as follows. There may be better ways of doing it. I just tried this work around to see if it works - and it did for me:
-
Use Azure CLI to sign in via the
PowerShell
(I have latest version 7.3) usingPS ...> az login
-
In the same PowerShell Window, set your desired subscription as follows:
PS ...> az account set --subscription 'Your subscription name or Id'
-
In
VSCode
, in any of the Azure task window, place your mouse over the task window (e.g. Static Web Apps window) label and click on the refresh icon as shown below. This will show list of all your subscriptions (I have two subscriptions shown below). Select your desired subscription.