How to access Azure Cloud Shell from Visual Studio Code

Contents

blue logo

the Azure Cloud Shell is an integrated CLI experience available to Microsoft Azure cloud users. Regularly available in a Linux Bash shell or PowerShell prompt, you can also use Azure Cloud Shell directly in the VS code integrated development environment.

What features does Azure Cloud Shell offer?

  • Bash shell for Linux style commands
  • PowerShell for Windows Familiar Developers
  • Integrated PowerShell Modules
    • Az Accounts.
    • The. Compute
    • Az.Network
    • Recursos Az.
    • Storage Az.
    • AzureAD.Standard.Preview
    • AzurePSDrive
    • PSCloudShellUtility
  • Latest version of Azure CLI (az command) available for Bash and PowerShell environments
  • Latest PowerShell available in Bash environment using pwsh execution time

Azure Cloud Shell automatically manages the authentication and configuration of all associated modules and tools. This makes it quick and easy to start managing your Azure environment from the command line..

Introducción a Azure Cloud Shell

Most users will get started with Azure Cloud Shell in one of two ways. Through the Azure portal and your online shell access or through a direct web link to Azure Shell.

Acceso a Azure Portal Shell

Connecting to the shell through the Azure Portal is as simple as clicking the terminal icon next to the search bar at the top of the screen.

Connect to the shell through the Azure portal by clicking the terminal icon next to the search bar.

As soon as you click this icon, one of the two shells will be displayed, either Bash terminal or PowerShell as seen below. In the first image, you will see that the Bash terminal has connected. If you use the drop-down menu at the top left of the terminal, you will have the option of Bash or PowerShell.

Bash terminal has connected.
Azure Cloud Shell is offline.

Direct access to Shell via the web

Another common method to start Azure Cloud Shell is through a direct link to the web portal. Navigating to https://shell.azure.com/ will open the Bash or PowerShell terminal. If you are not logged in, you will be prompted to do so before accessing. Once authenticated, you will have immediate access to the same terminal as in the Azure portal.

Navigate to https://shell.azure.com/ will open the PowerShell terminal.
Navigate to https://shell.azure.com/ will also open the Bash terminal.

Integration of Azure Cloud Shell with VS Code

In any case, as a developer, this may not be the most efficient method. A very popular editor released by Microsoft, VS Code, has become a well-integrated solution for accessing many different Azure resources and, in particular, a Azure Cloud Shell.

With an integrated development workflow and quick access to common Azure commands from within the editor itself, much time and energy can be saved. What are the steps required to start using Azure Cloud Shell in VS Code?

The quickest and easiest way to get started is to install the Azure account microsoft extension. Navigate to the icon “Extension” in the left menu of VS Code and look for Azure Account. Once the extension has been located, Click the button “Install”. After installation, you may need to restart VS Code, but as soon as the extension is available, you will have access to several different commands.

To start, install the official Microsoft Azure account extension.

To locate all available commands, scribe ctrl-shift-p to open the VS Code command panel. Click or select the option “Azure: Abrir PowerShell en Cloud Shell”.

Click or select the option

If you are not yet signed in through the Azure account extension, a message will be displayed. Click on “Log in” to access a web page using your default browser that enables you to log into your Azure account.

  Click on

Choose the account you want to use with Azure Cloud Shell and enter your password, if required. Once entered, the page will ask you to close the open browser window or tab, and VS Code will continue to authenticate in the background.

You may notice that the URL used to login is in the format, [localhost:123456](http://localhost:123456) where he 123456 it is a port chosen at random, generally in the range 62000.

Choose the account you want to use with Azure Cloud Shell and enter your password, if required.

This procedure is the same whether you choose the PowerShell terminal or the Bash terminal. As you can see below, once you have authenticated, both terminals will be available to you.

  Once you have authenticated, the PowerShell terminal will be available to you.
  Once you have authenticated, the Bash terminal will be available to you.

conclusion

Azure Cloud Shell integration in VS Code makes a developer's job much easier. Quick access to commands as you develop is essential for compiling information and running commands to see the results of those changes without constantly having to switch between different windows.. Use Azure Cloud Shell within VS Code today and see how much you can improve your efficiency.

Subscribe to our Newsletter

We will not send you SPAM mail. We hate it as much as you.