DEV Community

Cover image for Master Azure Development: Linking Cloud Shell with VS Code on Windows Made Easy
Oluwatobiloba Akinbobola
Oluwatobiloba Akinbobola

Posted on

Master Azure Development: Linking Cloud Shell with VS Code on Windows Made Easy

INTRODUCTION

If you are using Azure Cloud Shell and wish to combine it with VS Code on Windows, you may run into problems where the az command is not recognized in the Visual Studio Code (VS Code) terminal. Here's how to fix this problem step-by-step.
Step 1: Install Azure CLI

  1. Download the Azure CLI ZIP file from the official Azure CLI Releases page.
  2. Extract the ZIP file to a directory, e.g., C:\Users\<YourUsername>\AzureCLI.

Step 2: Add Azure CLI to PATH
To make the az command available in your terminal, you need to add the Azure CLI bin directory to your system's PATH.

Temporary Solution (Current Session Only)

  1. Open the terminal in VS Code (Ctrl+`).
  2. Run the following command to temporarily add the Azure CLI path to the PATH variable: $env:Path += ";C:\Users\<YourUsername>\AzureCLI\bin"
  3. Test the az command: az --version

Terminal Image

Permanent Solution

  1. Open PowerShell.
  2. Run the following command to add the Azure CLI path to your user PATH permanently: [Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\Users\<YourUsername>\AzureCLI\bin", "User")
  3. Restart VS Code and test the az command: az --version

Step 3: Verify the PATH in VS Code

  1. Open the integrated terminal in VS Code (Ctrl+`).
  2. Run the following command to check the PATH variable: $env:Path Ensure C:\Users\<YourUsername>\AzureCLI\bin is included.

Step 4: Troubleshooting
If the az command still doesn’t work:

  1. Ensure the bin folder contains the az.cmd or az.exe file.
  2. Restart your computer to apply all changes.
  3. Consider using the Azure CLI MSI installer for a hassle-free installation: Install Azure CLI.

CONCLUSTION

You can use the az command with ease and successfully link Azure Cloud Shell with Visual Studio Code on Windows by following these steps. This article guarantees that you can effectively manage your Azure resources from within Visual Studio Code, regardless of whether you opt for a temporary or permanent solution.

Do your career a big favor. Join DEV. (The website you're on right now)

It takes one minute, it's free, and is worth it for your career.

Get started

Community matters

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

πŸ‘‹ Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay