Visual Studio Code has a HUGE extension library. There’s also almost two dozen very nice Azure specific extensions as well as extensions for Docker, etc. If you write an Azure extension yourself, you can depend on the Azure Account Extension to handle the administrivia of the user logging into Azure and selecting their subscription. And of course, the Azure Account Extension is open source.
Here’s the cool part – I think, since I just learned it. You can have the Azure Account Extension installed (again, you can install it directly or you can get it as a dependency) you also get the ability to get an Azure Cloud Shell directly inside VS Code. That means a little container spins up in the Cloud and you can get a real bash shell or a real PowerShell shell quickly. AND the Azure Cloud Shell automatically is logged in as you and already has a ton of tools pre-installed.
Here’s how you do it.
- Install Visual Studio Code
- Install the Azure Account Extension
- run VS Code, then press Shift-Ctrl-P for the Command Palette
- Click Azure: Sign In
It will pop up a message with a “copy & open” button. It’ll launch a browser, then you enter a special code after logging into Azure to OAuth VS Code into your Account account.
At this point, open a Cloud Shell with Shift-Ctrl-P and type “Bash” or “PowerShell”…it’ll autocomplete so you can type a lot less, or setup a hotkey.
Your Cloud Shell will appear along side your local terminals!
Note that there’s a “clouddrive” folder mapped to your Azure Storage so you can keep stuff in there. Even though the Shell goes away in about 20 min of non-use, your stuff (scripts, whatever) is persisted.
There’s a bunch of tools preinstalled you can use as well!
scott@Azure:~$ node --version
scott@Azure:~$ dotnet --version
scott@Azure:~$ git --version
git version 2.7.4
scott@Azure:~$ python --version
scott@Azure:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
And finally, when you type “azure” or “az” for the various Azure CLI (Command Line Interface) tools, you’ll find you’re already authenticated/logged into Azure, so you can create VMs, list websites, manage Kubenetes clusters, all from within VS Code. I’m still exploring, but I’m enjoying what I’m seeing.
© 2017 Scott Hanselman. All rights reserved.