dev-resources.site
for different kinds of informations.
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
- Download the Azure CLI ZIP file from the official Azure CLI Releases page.
- 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)
- Open the terminal in VS Code (
Ctrl+
`). - Run the following command to temporarily add the Azure CLI path to the PATH variable:
$env:Path += ";C:\Users\<YourUsername>\AzureCLI\bin"
- Test the
az
command:az --version
Permanent Solution
- Open PowerShell.
- 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")
- Restart VS Code and test the
az
command:az --version
Step 3: Verify the PATH in VS Code
- Open the integrated terminal in VS Code (
Ctrl+
`). - Run the following command to check the PATH variable:
$env:Path
EnsureC:\Users\<YourUsername>\AzureCLI\bin
is included.
Step 4: Troubleshooting
If the az
command still doesn’t work:
- Ensure the
bin
folder contains theaz.cmd
oraz.exe
file. - Restart your computer to apply all changes.
- 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.
Featured ones: