0

When I type "az --version" on powershell, its showing me the current version. But when I type the same in the vs code terminal, it output an error saying "az : The term 'az' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."

I have installed all the required Azure cli extension on VS code, also I have set the environment variables on my local machine.

  • Without additional information, your problem cannot be diagnosed. [This answer](https://stackoverflow.com/a/68414006/45375) contains detailed troubleshooting steps. If they help you solve your problem, we can close your question as a duplicate. If you've tried everything there and it still doesn't work, please provide more information. – mklement0 May 12 '23 at 13:40

1 Answers1

2

Need to check below:

  • Check that the Azure CLI tools extension is properly installed in Visual Studio Code. When the extensions fail in the middle, the az command will stop working.
  • Go to settings and search terminal integrated shell as shown below. Check that the shell integration is enabled and the specific shell you've chosen is compatible with the Azure CLI versions.

enter image description here

After a workaround on this issue, I found a way to run CLI files in the Visual Studio Code by activating the "virtual environment".

Detailed steps given here for the Virtual env activation.

Once it is activated, install the Azure CLI package using pip.

pip install azure-cli

enter image description here

Once the installation done successfully, I created a file with the .azcli extension and executed it by going to command palette -> search for run line in terminal. It worked for me as expected.

enter image description here

To leave your virtual environment, use the deactivate command in the terminal.

If still the issue persists, restart & update the Vscode for the better functionality.

Jahnavi
  • 3,076
  • 1
  • 3
  • 10