Azure Cloud Shell – your own bash shell and container – right inside Visual Studio Code

Dev Tips


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.

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.

image

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!

Azure Cloud Shell in VS Code

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.

image

There’s a bunch of tools preinstalled you can use as well!

scott@Azure:~$ node --version
v6.9.4
scott@Azure:~$ dotnet --version
2.0.0
scott@Azure:~$ git --version
git version 2.7.4
scott@Azure:~$ python --version
Python 3.5.2
scott@Azure:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial

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.


Sponsor: Scale your Python for big data & big science with Intel® Distribution for Python. Near-native code speed. Use with NumPy, SciPy & scikit-learn. Get it Today




















Source link

Leave a Reply