无法在vsCode中使用Azure Developer CLI(azd),即使安装了扩展也不行。

huangapple go评论57阅读模式
英文:

Unable to use Azure Developer CLI (azd) in vsCode even after extensions installed

问题

我一直在尝试在Visual Studio Code(VSCode)中集成和使用Azure DevOps(AZD)进行我的开发工作。尽管尝试了多种方法和方式,但我一直遇到阻止成功利用的问题。

主要问题是,每次我尝试在VSCode中使用AZD时,操作都会失败。无论我尝试使用AZD的特定功能或功能是什么,这个问题都会持续存在。失败似乎与AZD扩展内的特定操作或命令无关。

我已经按照多个在线教程和官方文档来设置和在VSCode中使用AZD,确保所有必要的先决条件和设置都已正确配置。尽管如此,问题仍未解决。

  1. 安装** Azure Developer CLI **扩展:
    无法在vsCode中使用Azure Developer CLI(azd),即使安装了扩展也不行。

  2. 通过以下命令在vscode终端中安装独立的Azure Developer CLI。

powershell -ex AllSigned -c "Invoke-RestMethod 'https://aka.ms/install-azd.ps1' | Invoke-Expression"
VERBOSE: 从 https://azure-dev.azureedge.net/azd/standalone/release/latest/azd-windows-amd64.msi 下载构建
VERBOSE: 验证 D:\Users303906\AppData\Local\Tempofthncj.h02\azd-windows-amd64.msi 的签名
VERBOSE: 安装 MSI
VERBOSE: 清理临时安装目录: D:\Users303906\AppData\Local\Tempofthncj.h02
已成功安装 azd
Azure Developer CLI(azd)已成功安装。您可能需要重新启动运行的程序以使安装生效。
- 对于Windows Terminal,请启动新的Windows Terminal实例。
- 对于VSCode,请关闭所有VSCode实例,然后重新启动。

Azure Developer CLI会收集使用数据并将该使用数据发送给Microsoft,以帮助我们改善您的体验。
您可以通过在您使用的shell中将AZURE_DEV_COLLECT_TELEMETRY环境变量设置为'no'来选择退出遥测。

但当我尝试验证时,我仍然遇到了问题:

azd auth login

azd: 术语 'azd' 被识别为不是cmdlet、函数、脚本文件或可执行程序的名称。
请检查名称的拼写,或者如果包含了路径,请验证路径是否正确,然后重试。
英文:

I have been attempting to integrate and utilize Azure DevOps (AZD) within Visual Studio Code (VSCode) for my development work. Despite trying multiple methods and approaches, I have consistently encountered issues that prevent successful utilization.

The main problem is that every time I attempt to use AZD in VSCode, the operation fails. This issue persists regardless of the specific function or feature of AZD I'm trying to use. The failure does not seem to be tied to a specific action or command within the AZD extension.

I have followed several online tutorials and official documentation to set up and use AZD in VSCode, ensuring that all the necessary prerequisites and settings are correctly configured. Despite this, the problem remains unresolved.

  1. Install the** Azure Developer CLI ** extension:
    无法在vsCode中使用Azure Developer CLI(azd),即使安装了扩展也不行。

  2. Install the standalone Azure Developer CLI via the following command in vscode terminal.

powershell -ex AllSigned -c "Invoke-RestMethod 'https://aka.ms/install-azd.ps1' | Invoke-Expression"

VERBOSE: Downloading build from https://azure-dev.azureedge.net/azd/standalone/release/latest/azd-windows-amd64.msi
VERBOSE: Verifying signature of D:\Users03906\AppData\Local\Tempofthncj.h02\azd-windows-amd64.msi
VERBOSE: Installing MSI
VERBOSE: Cleaning temporary install directory: D:\Users03906\AppData\Local\Tempofthncj.h02
Successfully installed azd
Azure Developer CLI (azd) installed successfully. You may need to restart running programs for installation to take effect.
- For Windows Terminal, start a new Windows Terminal instance.
- For VSCode, close all instances of VSCode and then restart it.

The Azure Developer CLI collects usage data and sends that usage data to Microsoft in order to help us improve your experience.
You can opt-out of telemetry by setting the AZURE_DEV_COLLECT_TELEMETRY environment variable to 'no' in the shell you use.

But when I tried to verify, I still met the issue:

azd auth login

azd: The term 'azd' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

答案1

得分: 2

"当我尝试在我的环境中复现相同情况时,我得到了相同的错误。"

我遵循的安装Azure开发者CLI的步骤:

  1. 在Visual Studio Code中安装Azure开发者CLI->扩展:

无法在vsCode中使用Azure Developer CLI(azd),即使安装了扩展也不行。

无法在vsCode中使用Azure Developer CLI(azd),即使安装了扩展也不行。

要修复错误:

The term azd is not recognized as the name of the cmdlet

通过运行以下命令安装az模块:
Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force

无法在vsCode中使用Azure Developer CLI(azd),即使安装了扩展也不行。

"现在,可以登录到azd:"

无法在vsCode中使用Azure Developer CLI(azd),即使安装了扩展也不行。

"初始化了一个新项目:"

无法在vsCode中使用Azure Developer CLI(azd),即使安装了扩展也不行。

参考资料:
安装Azure开发者CLI

英文:

When I tried to reproduce the same in my environment, I was getting the same error.

无法在vsCode中使用Azure Developer CLI(azd),即使安装了扩展也不行。

Steps I followed to install Azure Developer CLI:

  1. Installed Azure Developer CLI in visual studio code->Extensions:

无法在vsCode中使用Azure Developer CLI(azd),即使安装了扩展也不行。

无法在vsCode中使用Azure Developer CLI(azd),即使安装了扩展也不行。

To fix the error:
>The term azd is not recognized as the name of the cmdlet

Install az module by running the below command:
Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force

无法在vsCode中使用Azure Developer CLI(azd),即使安装了扩展也不行。

Now, able to login to azd:

无法在vsCode中使用Azure Developer CLI(azd),即使安装了扩展也不行。

Initialized a new project:

无法在vsCode中使用Azure Developer CLI(azd),即使安装了扩展也不行。

References:
Install Azure Developer CLI

huangapple
  • 本文由 发表于 2023年6月1日 15:33:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/76379624.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定