Skip to content

[Issue] warn users when they need to install powershell 7 (or fallback to powershell 5) #4560

Description

@qubitron

Output from azd version
Run azd version and copy and paste the output here:

azd version 1.11.0 (commit 5b92e0687e1fa96dfc8292f4b900c0c58610b6a5)

Describe the bug

'pwsh' is not recognized as an internal or external command,
operable program or batch file.
WARNING: 'postprovision' hook failed with exit code: '1', Path: '.\scripts\write_env.ps1'. : exit code: 1
Execution will continue since ContinueOnError has been set to true.

To Reproduce
On a machine with powershell 5 command, run a sample that uses powershell post provision hooks, such as: https://github.com/azureai-samples/azureai-basic-python

Expected behavior
It took me a while to realize that pwsh is for powershell 7 and that powershell is for powershell 5, could azd check for the presence of pwsh and if it doesn't exist:

  • fallback to using ````powershell``` to run the command
  • guide users to install powershell 7

Environment
Windows, VS Code (latest), Python

* Language name and version
* IDE and version : [e.g. Visual Studio 16.3]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

area/error-handlingError suggestions, error frameworkarea/hooksLifecycle hooksarea/uxUX, prompts, output formatting

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions