Azure CLI 2.x is not installed on this machine

Viewed 2280

I'm trying to upload blobs using "az storage blob upload-batch". I got below two exceptions.

  1. ##[error]Azure CLI 2.x is not installed on this machine.
  2. ##[error]Script failed with error: Error: Unable to locate executable file: 'pwsh'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.
    task: AzureCLI@2
    displayName: 'Upload Files'
    inputs:
      azureSubscription: 'xxxxxxx'
      scriptType: 'pscore'
      scriptLocation: 'inlineScript'
      inlineScript: |
        $subscriptionName = $(az account show --query 'name' --output tsv) 
        az storage blob upload-batch `
          --subscription $subscriptionName `
          --account-name xxxxxxxxx `
          --source "C:\xxx\yyy" `
          --destination MyContainerName `
          --auth-mode login
1 Answers

Thank you @N MZ , Posting your suggestion as an answer to help other community members.

##[error]Azure CLI 2.x is not installed on this machine.

##[error]Script failed with error: Error: Unable to locate executable file: 'pwsh'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.

For this above errors we need to install Azure cli and check running cmd az version if its installed or not .

enter image description here

For More information please refer the below links:

Related