The Azure Cloud Shell Connector in Windows Terminal

Avatar

Pankaj

The Windows Terminal can now connect you to the Azure Cloud Shell!

We have a new default profile – the Azure Cloud Shell, which will allow you to access your Azure directories/tenants through the Windows Terminal app itself.

If you already have Windows Terminal installed

Your settings will not automatically update with the new default profile (since the file does not regenerate every time you open up Windows Terminal), so here’s how you can manually add it in.

  1. Start Windows Terminal
  2. Open up settings (using the dropdown)
  3. Add this profile to your list of profiles:

Once you’ve done this, you will see a new tab option for the Azure Cloud Shell.

How to use the connector

  1. Open up the “Azure Cloud Shell” tab.
  2. You will be prompted to go to “microsoft.com/devicelogin” and enter the code displayed.
  3. Once you enter the code in your browser, you will need to login with your account – make sure you log in with an account that has an active Azure directory/tenant.
  4. Switch back to Terminal and within a few seconds you will see an “Authenticated” message.
  5. Some cases only: if you have multiple tenants in your account, you will be prompted to choose one of them. Simply enter the tenant number of the one you wish to connect to.
  6. You will then be asked if you want to save these connection settings. Saving your connection settings will allow you to login without going through steps 1-5 in the future.
  7. The app will then start to establish a connection with the cloud shell (this could take a while, just be patient!)
  8. You are now connected to you Azure Cloud Shell!

Here’s what the full login output looks like: (I hit ‘0’ for the tenant number and ‘y’ for the choice on saving connection settings).

Now that I have saved my connection settings, here’s what the login process looks like the next time (I hit ‘0’ to access my saved connection settings).

It’s also possible to sign in with a different account/tenant by hitting ‘n’ or removing the saved connections by hitting ‘r’. These settings will persist across sessions, so even if you start up the Terminal a few days later you will still be able to log in with your saved connection settings without needing to open up a browser.

And past that, its all you! Hope you enjoy being able to access your Azure assets through the Windows Terminal. As always, please report any bugs/issues to our Github repository.

Avatar
Pankaj Bhojwani

Dev Intern, Windows Terminal

Follow Pankaj   

8 Comments
Avatar
Alexsandro Pereira 2019-08-03 17:54:01
Something happen with my background, when I'm list files with ls command, the font color is same color of my black background.
Avatar
Jeff Miles 2019-08-04 06:58:00
This is really awesome - I look forward to using this functionality. Right now the PowerShell cloud drive isn't really usable though. I can't find a way to make it default, and after starting it manually with "pwsh", it's both super slow to respond to input, and commands appear at the top of the window rather than following the prompt, merging the display with what was already on the screen. 
Avatar
Alec Clews 2019-08-05 17:09:39
So I think there is some magic here? I can't find out how the `"connectionType"` property works (I hunted through the Terminal codebase).(I wanted to create something similair for Google Cloud Shell)
Avatar
Jasper Zanjani 2019-08-08 15:35:44
What functionality does this provide that is not reproducible by simply logging in to your Azure account (`Connect-AzAccount` in PowerShell or `az login` for Azure CLI)?
Avatar
Darrick West 2019-08-09 15:38:55
Cool. How do we add PowerShell in profiles.json? Running pwsh is not a good experience; cursor location anomalies.
Avatar
Jeffrey Odell 2019-08-12 04:10:59
Thank you for outlining this - I'm loving it.   One small anomaly I ran in to - this message: To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code XXXXXXXX to authenticate. ....does not word wrap.  Make sure your instance of Windows Terminal is large enough that the message fits across the screen, or your device code can get cut off. Very much appreciated - well done!