Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue] azd CLI is not detected in VS Code terminal #1441

Closed
1 task done
indcoder opened this issue Jan 23, 2023 · 15 comments
Closed
1 task done

[Issue] azd CLI is not detected in VS Code terminal #1441

indcoder opened this issue Jan 23, 2023 · 15 comments
Assignees
Labels
bug Something isn't working customer-reported identify a customer issue needs-team-attention Issues out of a milestone question upstream deps vscode Visual Studio Code

Comments

@indcoder
Copy link

Output from azd version
azd version 0.5.0-beta.3 (commit 1c23678)

Output from az version
Run az version and copy and paste the output here (minimum required version is 2.38.0):
{
"azure-cli": "2.43.0",
"azure-cli-core": "2.43.0",
"azure-cli-telemetry": "1.0.8",
"extensions": {}
}

Describe the bug
While the azd cli can be run from the Windows terminal across different shells,

image

it fails when done via VS Code terminal

image

I presume this is the root cause for the failure of azd init when executed via VS Code Command Palette

image

Apparently it cannot detect azd.

image

To Reproduce
Run the azd -h command in the VS Code terminal
or
Any azd command via the VS Code command palette

Expected behavior
The azd init command should be run and the project files generated.

Environment
Information on your environment:
* Language name and version
* IDE and version : [e.g. Visual Studio 16.3]
VS Code Insider
Version: 1.75.0-insider (user setup)
Commit: 1379f0375440df946adc62f7afb8375dd45d5adf
Date: 2023-01-17T05:21:07.217Z
Electron: 19.1.9
Chromium: 102.0.5005.194
Node.js: 16.14.2
V8: 10.2.154.23-electron.0
OS: Windows_NT x64 10.0.22623
Sandboxed: Yes

Additional context
I'm presuming the azd-cli is not being added to the path which can be detected by VS Code terminal when installation is done via MSI
azure-cli-2.43.0.msi

@ghost ghost added needs-triage For new issues customer-reported identify a customer issue question labels Jan 23, 2023
@bwateratmsft bwateratmsft added the vscode Visual Studio Code label Jan 23, 2023
@ghost ghost removed the needs-triage For new issues label Jan 23, 2023
@bwateratmsft
Copy link
Contributor

This is similar to microsoft/vscode-docker#3806. I wonder if there's a VSCode issue with discovery of things on the PATH.

@bwateratmsft
Copy link
Contributor

@indcoder In a Nushell terminal window in VSCode, can you check the value of the PATH environment variable? I believe the command is $env.PATH. Does that value contain C:\Users\YourUserName\AppData\Local\Programs\Azure Dev CLI\?

@indcoder
Copy link
Author

indcoder commented Jan 23, 2023

Yes, the path environment variable has that value

But, I don't think so it has to do something with nu....because the Command palette is executing it in its own task process[most probably powershell....looking the at the error message]

image

@bwateratmsft
Copy link
Contributor

@indcoder does the issue occur with Electron sandboxing disabled?
image

@jongio
Copy link
Member

jongio commented Jan 23, 2023

Did you completely close VS Code after installing azd?

@indcoder
Copy link
Author

indcoder commented Jan 23, 2023 via email

@bwateratmsft
Copy link
Contributor

This may unblock you, but there is an environment variable, AZURE_DEV_CLI_PATH, that can be used to set the path to the Azure Dev CLI. Generally it's located at C:\Users\YourUserName\AppData\Local\Programs\Azure Dev CLI\azd.exe.

It seems like some part of the PATH isn't making it into shell processes spawned by the extension host or VSCode itself (which would include terminal windows in VSCode), even though VSCode does have the right values in process.env.PATH. I tried with sandboxing both enabled and disabled and everything worked. I wonder if there's some Node.js setting causing this.

@indcoder
Copy link
Author

indcoder commented Jan 24, 2023 via email

@bwateratmsft
Copy link
Contributor

A Docker extension user filed microsoft/vscode#172124, which might be the root cause of this issue and the issues that user is seeing.

@ghost ghost added the needs-team-attention Issues out of a milestone label Jan 24, 2023
@rajeshkamal5050 rajeshkamal5050 added this to the Release 0.7 milestone Jan 30, 2023
@savannahostrowski
Copy link

I'm presuming the azd-cli is not being added to the path which can be detected by VS Code terminal when installation is done via MSI - azure-cli-2.43.0.msi

@indcoder Can you confirm that you've installed azd from aka.ms/azd-install? Looks like you're referring to the Azure CLI above (which is a different tool)!

@indcoder
Copy link
Author

indcoder commented Feb 3, 2023

Yes, @savannahostrowski I have installed it from that location. Also as mentioned in my original post, the issue is not in azd cli where it works, but in the azd vs code extension.

@bwateratmsft
Copy link
Contributor

Aside from something upstream like microsoft/vscode#172124 I'm not sure what could be happening. PATH seems all messed up lately in VSCode.

@rajeshkamal5050 rajeshkamal5050 modified the milestones: Backlog, Release 0.7 Feb 6, 2023
@rajeshkamal5050 rajeshkamal5050 added the bug Something isn't working label Feb 7, 2023
@rajeshkamal5050
Copy link
Contributor

@bwateratmsft want to keep this open or close it as not reproducible?

@bwateratmsft
Copy link
Contributor

@rajeshkamal5050 I think we can close it unless we can find more information.

@indcoder
Copy link
Author

So I was still getting this issue on my machine after I did a complete reinstall of the OS due to a hardware issue..

A bit of digging I keep came across a stack overflow issue for other cmdlets not being found ....a solution was proposed regarding VS code attaching the incorrent Powershell...so from the VS Code command palette

image

Ensure you pick the correct version of powershell

image

and then the azd cli extension worked correctly and the template dropdown was available

Putting this out here if some one also faces this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working customer-reported identify a customer issue needs-team-attention Issues out of a milestone question upstream deps vscode Visual Studio Code
Projects
None yet
Development

No branches or pull requests

5 participants