Skip to content

PowerShell 7 suggestion text not showing for service-level hooks #5453

Description

@JeffreyCA

Related:
/issues/4560
/pull/4872

Repro

  1. azd init --template Azure-Samples/todo-python-mongo
  2. If testing on Linux, edit azure.yaml to change the shell from sh to pwsh.
  3. Make sure PS 7 is uninstalled, or temporarily rename pwsh in your PATH to something like pwsh1.
  4. azd package web

Observed:

Image

There should be a suggestion text printed out, like:

PowerShell 7 is not installed or not in the path. To install PowerShell 7, visit https://learn.microsoft.com/powershell/scripting/install/installing-powershell

Additional details

It seems that service-level hooks do not show the suggestion text when pwsh isn't installed, but command(?) hooks do:

Service-level hooks

services:
  web:
    project: ./src/web
    dist: dist
    language: js
    host: appservice
    hooks:
      prepackage:
        windows:
          shell: pwsh
          run: 'echo "VITE_API_BASE_URL=""$env:API_BASE_URL""" > .env.local ; echo "VITE_APPLICATIONINSIGHTS_CONNECTION_STRING=""$env:APPLICATIONINSIGHTS_CONNECTION_STRING""" >> .env.local'
Command Suggestion text shown?
azd package web
azd hooks run prepackage --service web

Command hooks

hooks:
  preprovision: 
    posix:
      shell: pwsh
      run: 'echo "AZURE_STORAGE_CONNECTION_STRING=$env:AZURE_STORAGE_CONNECTION_STRING" > .env'
    windows:
      shell: pwsh
      run: 'echo "AZURE_STORAGE_CONNECTION_STRING=$env:AZURE_STORAGE_CONNECTION_STRING" > .env'
Command Suggestion text shown?
azd provision
azd hooks run preprovision

Metadata

Metadata

Labels

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

Type

Fields

No fields configured for Bug.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions