Scott Hanselman

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

December 03, 2017 Comment on this post [7] Posted in Azure
Sponsored By

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.

VS Code Command Palette

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"'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.


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
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

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
December 03, 2017 12:05

I find the cloud shell in a browser a little buggy and slow to start. However, using this method it started within a few seconds.
December 05, 2017 10:17
Very cool! Looks promising despite the slow start and not seeming to work with PowerShell yet (preview I believe). Bash seems to work well.

Connecting terminal..........
Welcome to Azure Cloud Shell (Preview)

Type "dir" to see your Azure resources
Type "help" to learn about Cloud Shell

Warning: Failed to mount the Azure file share. Your cloud drive won't be available.
Your Cloud Shell session will be ephemeral so no files or system changes will persist beyond your
current session.
VERBOSE: Authenticating to Azure ...
Connect-AzureAD : Cannot validate argument on parameter 'AadAccessToken'. The argument is null
or empty. Provide an argument that is not null or empty, and then try the command again.
At C:\Users\ContainerAdministrator\PSCloudShellStartup.ps1:104 char:43
+ & $script:AzureAD\Connect-AzureAD @azureADParameters -ErrorAc ...
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Connect-AzureAD], ParameterBindingValidationExce
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Open.Azure.AD.CommonLib

VERBOSE: Building your Azure drive ...
December 07, 2017 23:23
Hi Scott,

I tried it but when I start the Bash shell first time, it said I had to open Azure at I follow the link button and get some Auth2 thing redirect and end at as usual but then ... nothing. If I go back to Visual Code and try and restart the Bash shell, same shit. So kinda stuck there with no log.
December 08, 2017 20:01
I find the cloud shell in a browser a little buggy and slow to start.

Win coupons and prizes , complete the folowing surveys
MCDvoice Survey is McDonald’s survey of their customers mcdvoice survey
Since this survey is so huge in terms of the prize money and the reputation of the company, there are a few possibilities that online scammers might be lurking out there to get the best out of you tellhalfordsautocentres
Staples Customer Satisfaction survey at lets you win $1,000.00 CAD STAPLES Business Depot Bureau en Gros shopping spree
Red Lobster wants to know how are they are performing in the market and what are the things that their customers like or dislike about them RedLobsterSurvey
To take part in this tell the bell survey by fulfilling the basic requirements from Tell The Bell Survey TellTheBell survey
Europe is the continent which exports the makeup of its top brands to all other countries of the globe, making European makeup brands more demanding and top rated European makeup brands
Christmas can’t be examined without reference to uncommon Christmas costumes that are worn on this event Christmas costumes

The best Structured settlement companies will work with you to get you the cash you require
If you have an explanation for requiring a single amount rather than an annuity Structured settlement companies
Bwwlistens survey or BWW Listens at is an online survey which offers its customers to win $500 Bwwlistens

TalkToRegal customer satisfaction survey is a filthy source to express your opinion and to let know company about your feedback TalkToRegal
Kroger Feedback customer satisfaction survey is one of the great online portals through which you can take part in Kroger sweepstakes Survey krogerfeedback

December 10, 2017 19:41
Would be nice to expand on the following:

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.

For those of us who are new to this.

December 12, 2017 12:12
December 14, 2017 15:32
Seems that they removed the azure logo ascii art? Thanks for pointing out the Azure CLI in VS Code! it's great.

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.