Connect to Microsoft Azure Directly From Visual Studio Code

In this blog post, I’ll show you how to connect to Microsoft Azure Cloud Shell directly from Visual Studio Code and run Azure CLI 2.0 commands.

About Visual Studio Code

Visual Studio Code is a source code editor developed by Microsoft for Windows, Linux and macOS. It includes support for debugging, embedded Git control, syntax highlighting, intelligent code completion, snippets, and code refactoring.


To connect to Microsoft Azure directly from VS the only requirements are to have the latest Visual Studio version and Install the Azure Account extension.

Install the Azure Account extension

To get started, From the extensions menu search for Azure Account and click Install

Once I Installed the extension I must restart VS.

Access Cloud Shell

To access login and use Azure Cloud Shell, I’ll open the Command Palette (Ctrl + Shift + P) and click on Azure Sign In (If you don’t see It type Azure)

After clicking on Azure Sign In you will, Open the browser and authenticate yourself

After I click on Copy & Open I’ll be redirected to the Azure Authentication page

Now that I’ve authenticated I can either use PowerShell or Bash to connect to Cloud Shell, I’ll start with PowerShell

PowerShell With Cloud Shell

If I select Open PowerShell with Cloud Shell I’ll start session process.

As you can see below,  a PowerShell session started and I can also use Linux CLI 2.0 ( Recommended) as you will see below.

Linux Bash Azure CLI 2.0

If I click on Open Bash In Cloud Shell, Azure CLI 2.0 will open

To see Azure CLI 2.0 commands I simply type az help


There Is no doubt that Visual Studio Code Is position itself as the ultimate coding and console tool (and free).

At this stage, PowerShell Is still In preview mode but my recommendation is to use the Bash and Linux because Azure CLI 2.0 Is very powerful

1 thought on “Connect to Microsoft Azure Directly From Visual Studio Code”

  1. Hey there.. First off thank you for this. I’ve spent most of the morning trying to find the proper method for ‘Powershelling’ into AzureAD.
    Second, Does this require something other than free tier AzureAD?

    I installed the Node.js requirement, then followed the second step on setting up Bash or Powershell access and was told that no subscriptions were found for my user. The issue with that is my user is a tenant admin on a working tenant with ADConnect, 300+ users and mailboxes in ExchOnline.

Comments are closed.