Introduction

This is chapter-3 of my Azure Cloud Shell Web Series and today we are discussing – How to use Azure Cloud Shell from your local machine using Visual Studio Code and how to mount underlying Cloud Drive File Share of the Azure Cloud Shell on your local machine as a PowerShell Drive (PSDrive).

Video Chapter

If you like this video, please subscribe to my youtube channel here which is the motivation for me to create more such videos 🙂 thank you!

Azure Cloud Shell on Visual Studio Code

First I’ll click on the Extension icon on the left and search for Azure Account extension for visual studio code, then install it. The Azure Account extension provides a single Azure sign-in and subscription filtering experience for all other Azure extensions. It also makes Azure’s Cloud Shell service available in VS Code’s integrated terminal.

On windows this extension will require Node.JS and if not already installed it will prompt you to do the installation

Once the extension in installed you’ve to reload the Visual Studio Code Editor, by clicking on the Reload button

Now go to your command palette (CTRL_SHIFT+P) and Sign-in to your Azure Subscription,

Once you click on Sign-in, Visual Studio Code will prompt you to copy a code and Open a device login web page, so click on “Copy & Open”

Now in your browser paste the code to authenticate you Visual Studio Code, and once authenticated you’ll see your subscribed email address at the bottom of the VSCode editor. You can click this email address and choose your subscription in case you have multiple.

Once you are signed in, go to your command palette (CTRL+SHIFT+P) again and search “Azure: Open PowerShell in Cloud Shell” from the drop down menu and click it.

This will authenticate and Launch Azure Cloud Shell in your console and you’ll observe the Azure Drive getting build and mapped to the terminal.



Mount a Azure Cloud Shell drive (Cloud Drive) in local PowerShell Session

In couple of scenarios you may want to access the files share in the Cloud Drive of your Azure Cloud Shell from your local machine, and make changes to it. In order to do that, you have to first go to you azure portal https://portal.azure.com and inside the Storage account which holds your file share, you’ll find a ‘Connect button’, click it.

Now a blade will appear at the right side, where you can choose a Drive letter and copy the auto-generated PowerShell Commands to map your Cloud Drive to any machine with PowerShell.

Now on a local machine, execute this set of commands to to mount you cloud drive. You can access this cloud drive and makes changes to it, which will also reflect in your azure portal.

Follow @SinghPrateik