Connect to Azure Cloud Shell in Windows Terminal Preview

Windows Terminal 1 hero

This month, Microsoft issued a significant update to the preview version of Windows Terminal, the new console application for Windows 10. Announced at Build in Seattle at the beginning of May 2019, Windows Terminal will eventually replace the console that’s currently built-in to Windows 10. Microsoft has reached the end of the road with the current console because while it has seen some minor improvements over the last couple of years, new features can’t be added without breaking backwards compatibility. So, Microsoft took the decision to start from scratch and develop a new terminal.

In a post on Microsoft’s Windows Command Line Tools For Developers blog, Kayla Cinnamon announced that the latest build includes a connector for Azure Cloud Shell. Azure Cloud Shell is a browser-based command-line console hosted in the cloud that gives you access to Azure files and projects via Bash and PowerShell. Windows Terminal 0.3 lets you add an Azure Cloud Shell profile and connect to Azure directly from the terminal window.

Azure Cloud Shell Connector

If you are installing Windows Terminal from the Microsoft Store for the first time, you will see the option to connect to Azure from the dropdown menu next to the new tab button on the title bar. If you are upgrading from an earlier release of Windows Terminal, you’ll need to add the Azure Cloud Shell Connector profile to your settings file.

Figure1
Connect to Azure Cloud Shell in Windows Terminal Preview (Image Credit: Russell Smith)

To add the Azure Cloud Shell Connector profile to your settings, follow the instructions below.

  • Open Windows Terminal and press CTRL+, (the control key and comma at the same time). This will open the json file.
  • Scroll down to the “profiles” : section of the file and add the following profile to the file.
    {
    "acrylicOpacity" : 0.6,
    "closeOnExit" : false,
    "colorScheme" : "Vintage",
    "commandline" : "Azure",
    "connectionType" : "{d9fcfdfa-a479-412c-83b7-c5640e61cd62}",
    "cursorColor" : "#FFFFFF",
    "cursorShape" : "bar",
    "fontFace" : "Consolas",
    "fontSize" : 10,
    "guid" : "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
    "historySize" : 9001,
    "icon" : "ms-appx:///ProfileIcons/{b453ae62-4e3d-5e58-b989-0a998ec441b8}.png",
    "name" : "Azure Cloud Shell",
    "padding" : "0, 0, 0, 0",
    "snapOnInput" : true,
    "startingDirectory" : "%USERPROFILE%",
    "useAcrylic" : true
}
  • Close and save json.
  • Now you will see Azure Cloud Shell in the dropdown menu in Windows Terminal.
Figure2
Connect to Azure Cloud Shell in Windows Terminal Preview (Image Credit: Russell Smith)

When opening a new Azure Cloud Shell session in Windows Terminal for the first time, you’ll need to follow a web-based connection process. Just follow the instructions provided in the terminal window. It involves going to https://microsoft.com/devicelogin and entering a code provided in the terminal.

Figure3
Connect to Azure Cloud Shell in Windows Terminal Preview (Image Credit: Russell Smith)

Once you’ve entered the code, you’ll be prompted to sign in to your Azure subscription in the browser. After sign-in, you’ll be redirected back to Windows Terminal where you might be required to choose a tenant ID to use before getting access to Azure Cloud Shell.

Figure4
Connect to Azure Cloud Shell in Windows Terminal Preview (Image Credit: Russell Smith)

Bash is Default Azure Cloud Shell

The terminal session defaults to Bash. Changing to PowerShell is as simple as typing pwsh and pressing ENTER. But I found that switching to PowerShell is buggy in this release. Hopefully in a future version, Microsoft will allow you to configure the default shell in the settings file (profiles.json).

The Azure Cloud Shell Connector is the most interesting feature in this preview version of Windows Terminal. But there are some other major improvements, including the ability to drag the terminal window from anywhere on the title bar, a better dropdown button layout, accessibility improvements, and new background options. For a full list of changes, check out Microsoft’s blog post here.