Getting this error when using an Azure CLI Release Pipleline Task.
Greensharesthoughts, GreenOneFoodTrucksV2, GreenOneFoodTrucksV2-CD/220181216.9
VS2017
Script failed with error: Error: Unable to locate executable file: 'D:ar1a_GreenOneFoodTrucksV2-CIdropdeploy.sh'. 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.
See attached
See attached
same here for azure CLI release task.
@ToMakeSense Are you using hosted agent too?
@michaeldeongreen @ToMakeSense Does the same error repro on private agent? If so is it possible to manually check if the file exists on private agent. From the download logs it seems like the file was downloaded, so it seems strange of it not to exist at task execution time.
same here. Hosted VS2017 agent.
Script is in $(System.DefaultWorkingDirectory)/_ArtifactName/SubDir/Script.sh
When configuring the task and browsing for the file in the artifact files tree, it's here.
@Patafoin Is it possible to check if the issue occurs on private agent too? If so can you manually verify that the script is indeed present on the agent machine?
@omeshp : Just tried with my local build agent, same error. I checked the path and the file is present.
For your information : my file is called Test.sh and its content is :
az --version
@Patafoin Thanks for trying this out, can you share your release and agent logs at RM Customer Queries RM_Customer_Queries@microsoft.com
Done, thanks
Changing .sh extension to .bat and rewriting the script in a batch format does the trick.
sh files are not supported by windows agents.
Thanks Omesh
Hey @Patafoin
This is right. On windows based agent Azure cli will support .CMD or .Bat files where as on Linux based agents the task will support .SH files.
We will update the task documentation to explicitly call this out.
Hi there I am having the same issue however I am not runing the shell scripting I am using the powershell with Azure CLI Task.
2019-08-29T10:47:25.5424077Z ##[debug]Evaluating condition for step: 'Configuration -Tier2 Kubernetes Secrets.'
2019-08-29T10:47:25.5424807Z ##[debug]Evaluating: succeeded()
2019-08-29T10:47:25.5425014Z ##[debug]Evaluating succeeded:
2019-08-29T10:47:25.5425250Z ##[debug]=> True
2019-08-29T10:47:25.5425511Z ##[debug]Result: True
2019-08-29T10:47:25.5425698Z ##[section]Starting: Configuration -Tier2 Kubernetes Secrets.
2019-08-29T10:47:25.5539415Z ==============================================================================
2019-08-29T10:47:25.5539539Z Task : Azure CLI
2019-08-29T10:47:25.5539617Z Description : Run Azure CLI commands against an Azure subscription in a Shell script when running on Linux agent or Batch script when running on Windows agent.
2019-08-29T10:47:25.5539709Z Version : 1.155.1
2019-08-29T10:47:25.5539762Z Author : Microsoft Corporation
2019-08-29T10:47:25.5539845Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-cli
2019-08-29T10:47:25.5539924Z ==============================================================================
2019-08-29T10:47:25.7817284Z ##[debug]agent.workFolder=d:a
2019-08-29T10:47:25.7848684Z ##[debug]loading inputs and endpoints
2019-08-29T10:47:25.7855891Z ##[debug]loading ENDPOINT_AUTH_f1f48941-6faf-42b0-8fa9-a94b43690b24
2019-08-29T10:47:25.7868002Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_f1f48941-6faf-42b0-8fa9-a94b43690b24_AUTHENTICATIONTYPE
2019-08-29T10:47:25.7870767Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_f1f48941-6faf-42b0-8fa9-a94b43690b24_SERVICEPRINCIPALID
2019-08-29T10:47:25.7873184Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_f1f48941-6faf-42b0-8fa9-a94b43690b24_SERVICEPRINCIPALKEY
2019-08-29T10:47:25.7874741Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_f1f48941-6faf-42b0-8fa9-a94b43690b24_TENANTID
2019-08-29T10:47:25.7876438Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
2019-08-29T10:47:25.7878295Z ##[debug]loading ENDPOINT_AUTH_SCHEME_f1f48941-6faf-42b0-8fa9-a94b43690b24
2019-08-29T10:47:25.7880131Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
2019-08-29T10:47:25.7882910Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
2019-08-29T10:47:25.7894704Z ##[debug]loading INPUT_ADDSPNTOENVIRONMENT
2019-08-29T10:47:25.7895409Z ##[debug]loading INPUT_ARGS
2019-08-29T10:47:25.7896247Z ##[debug]loading INPUT_CONNECTEDSERVICENAMEARM
2019-08-29T10:47:25.7896635Z ##[debug]loading INPUT_CWD
2019-08-29T10:47:25.7896850Z ##[debug]loading INPUT_FAILONSTANDARDERROR
2019-08-29T10:47:25.7897044Z ##[debug]loading INPUT_SCRIPTLOCATION
2019-08-29T10:47:25.7897460Z ##[debug]loading INPUT_SCRIPTPATH
2019-08-29T10:47:25.7899583Z ##[debug]loading INPUT_USEGLOBALCONFIG
2019-08-29T10:47:25.7915479Z ##[debug]loaded 17
2019-08-29T10:47:25.7927905Z ##[debug]check path : d:a_tasksAzureCLI_46e4be58-730b-4389-8a2f-ea10b3e5e8151.155.1task.json
2019-08-29T10:47:25.7929975Z ##[debug]set resource file to: d:a_tasksAzureCLI_46e4be58-730b-4389-8a2f-ea10b3e5e8151.155.1task.json
2019-08-29T10:47:25.7930329Z ##[debug]system.culture=en-US
2019-08-29T10:47:25.7950005Z ##[debug]which 'az'
2019-08-29T10:47:25.8174940Z ##[debug]found: 'C:Program Files (x86)Microsoft SDKsAzureCLI2wbinaz.cmd'
2019-08-29T10:47:25.8199879Z ##[debug]scriptLocation=scriptPath
2019-08-29T10:47:25.8206409Z ##[debug]cwd=d:ar1a
2019-08-29T10:47:25.8208114Z ##[debug]scriptPath=d:ar1a_InfraDev-Build-DEVDEVKubernetes.aks_2.0Scriptstier2.kubernetes.aks.sp.add.secrects.ps1
2019-08-29T10:47:25.8208325Z ##[debug]check path : d:ar1a_InfraDev-Build-DEVDEVKubernetes.aks_2.0Scriptstier2.kubernetes.aks.sp.add.secrects.ps1
2019-08-29T10:47:25.8211618Z ##[debug]cwd=d:ar1a
2019-08-29T10:47:25.8223671Z ##[debug]Absolute path for pathSegments: d:ar1a = d:ar1a
2019-08-29T10:47:25.8224007Z ##[debug]build.sourcesDirectory=undefined
2019-08-29T10:47:25.8224318Z ##[debug]system.defaultWorkingDirectory=d:ar1a
2019-08-29T10:47:25.8224625Z ##[debug]Absolute path for pathSegments: d:ar1a = d:ar1a
2019-08-29T10:47:25.8226430Z ##[debug]cwdpath supplied :false
2019-08-29T10:47:25.8226906Z ##[debug]args=-keyVaultName "digital-dev-avk-001" -servicePrincipalIdKey "$(servicePrincipalIdKey)" -servicePrincipalIdValue "$(servicePrincipalId)" -servicePrincipalSecretKey "$(servicePrincipalSecretKey)" -servicePrincipalSecretValue "$(servicePrincipalSecret)"
2019-08-29T10:47:25.8229104Z ##[debug]failOnStandardError=false
2019-08-29T10:47:25.8232175Z ##[debug]testing directory 'd:ar1a_InfraDev-Build-DEVDEVKubernetes.aks_2.0Scripts'
2019-08-29T10:47:25.8240204Z ##[debug]which 'd:ar1a_InfraDev-Build-DEVDEVKubernetes.aks_2.0Scriptstier2.kubernetes.aks.sp.add.secrects.ps1'
2019-08-29T10:47:25.8248026Z ##[debug]not found
2019-08-29T10:47:25.8272469Z ##[debug]task result: Failed
2019-08-29T10:47:25.8274118Z ##[error]Script failed with error: Error: Unable to locate executable file: 'd:ar1a_InfraDev-Build-DEVDEVKubernetes.aks_2.0Scriptstier2.kubernetes.aks.sp.add.secrects.ps1'. 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.
2019-08-29T10:47:25.8274579Z ##[debug]Processed: ##vso[task.issue type=error;]Script failed with error: Error: Unable to locate executable file: 'd:ar1a_InfraDev-Build-DEVDEVKubernetes.aks_2.0Scriptstier2.kubernetes.aks.sp.add.secrects.ps1'. 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.
2019-08-29T10:47:25.8275106Z ##[debug]Processed: ##vso[task.complete result=Failed;]Script failed with error: Error: Unable to locate executable file: 'd:ar1a_InfraDev-Build-DEVDEVKubernetes.aks_2.0Scriptstier2.kubernetes.aks.sp.add.secrects.ps1'. 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.
2019-08-29T10:47:25.8337740Z ##[section]Finishing: Configuration -Tier2 Kubernetes Secrets.
Hey @Chirag1233
Azure CLI task only supports .bat/.cmd file on windows based agent. Hence, you would need to call PowerShell script from inside a .bat/.cmd file.
@bishal-pdMSFT @pulkitaggarwl
Should we consider adding PowerShell script support for Azure CLI task ?
I have the same issue. Actually, it's quite unnatural that it does not support executing PowerShell scripts and on top of that, it doesn't generate a helpful error log.
However, the good news is that in Azure CLI v2 supports Powershell Scripts. Make sure to change the task version.
Support for PowerShell scripts has been added in Azure CLI v2 task. Please upgrade to that task to use PowerShell/PowerShell Core scripts
argggggg....
I continue to get the same error using a task of Bash@3:
- task: Bash@3
displayName: 'Generate code coverage report'
inputs:
filePath: './scripts/code-coverage-reporting.sh'
failOnStderr: false
@hiyadav the documentation for a bash task still says it works on Windows: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/bash?view=azure-devops, but I am still getting this error and based on this issue - there is no plan to add bash support for Windows.
bash forever!, PowerPastel Sucks!
I ended up getting around this by writing all my bash logic in node, using an npm task, and then reading that in to a variable with a PowerShell command. Please do respond though to tell me if the docs are right or if @hiyadav is right
Hi,
I'm not aware about the bash task issue, this was more about azure cli task. If you want some more information on bash task, please open a new issue on the same repo, it will get directed to the right team !
This issue is still happening. Pretty annoying.
Why in the world does this need to be .sh file ending? I used .azcli as this enables syntax awareness in VS Code and now ran into this issue as well.
This should be fixed ASAP!
I guess the reason it worked because Linux agent only support **core** version of **PowerShell**
Thanks @vikramdadwal - I have managed to run the inline script.
However I am still getting the error:
##[error]Script failed with error: Error: Script file could not be found at specified script location: '/home/vsts/work/1/s...
If I am trying to use an existing .sh script in my repository.
(Using Agent Ubuntu latest, and Powershell Core for script type)
Has anyone managed to run .sh script with Azure CLI@2 and PowerShell Core on Ubuntu agent with a path to a script ?
(please note I have used the UI and the file was recognised and selected, hence it does exist).
##[error]Script failed with error: Error: Script file could not be found at specified script location: '/home/vsts/work/1/s...
If I am trying to use an existing .sh script in my repository.(Using Agent Ubuntu latest, and Powershell Core for script type)
Has anyone managed to run .sh script with Azure CLI@2 and PowerShell Core on Ubuntu agent with a path to a script ?
(please note I have used the UI and the file was recognised and selected, hence it does exist).
From what I have understood this combination does not work. You need to use .sh file ending for bash scripts and .ps1 for Powershell.
Most helpful comment
@bishal-pdMSFT @pulkitaggarwl
Should we consider adding PowerShell script support for Azure CLI task ?