-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Azure DevOps pipeline that uses AZ CLI start failing with the error "The System cannot find the file specified" #31248
Description
Describe the bug
Azure DevOps pipelines/YAML templates that use Azure CLI task fails to deploy Bicep files with the error "The System cannot find the file specified." It stared happening after the pipeline started downloading the lates AZ CLI version. i.e., 2.71.0.
Related command
az deployment group validate
Errors
The system cannot find the file specified.
Issue script & Debug output
Traceback (most recent call last):
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 666, in execute
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 734, in _run_jobs_serially
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 726, in _run_job
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/arm.py", line 114, in handle_template_based_exception
knack.util.CLIError: [WinError 2] The system cannot find the file specified
ERROR: cli.azure.cli.core.azclierror: [WinError 2] The system cannot find the file specified
ERROR: az_command_data_logger: [WinError 2] The system cannot find the file specified
DEBUG: cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x0000020175C27560>]
INFO: az_command_data_logger: exit code: 1
Expected behavior
Validation of the bicep file should start and either fail or succeed, if failed, the error(s) should be related to the bicep file being validated.
Environment Summary
Traceback (most recent call last):
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/arm.py", line 109, in handle_template_based_exception
AttributeError: 'FileNotFoundError' object has no attribute 'inner_exception'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 666, in execute
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 734, in _run_jobs_serially
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 726, in _run_job
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/arm.py", line 114, in handle_template_based_exception
knack.util.CLIError: [WinError 2] The system cannot find the file specified
ERROR: cli.azure.cli.core.azclierror: [WinError 2] The system cannot find the file specified
ERROR: az_command_data_logger: [WinError 2] The system cannot find the file specified
DEBUG: cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x0000020175C27560>]
INFO: az_command_data_logger: exit code: 1
INFO: cli.main: Command ran in 1.340 seconds (init: 0.406, invoke: 0.934)
INFO: telemetry.main: Begin splitting cli events and extra events, total events: 1
INFO: telemetry.client: Accumulated 0 events. Flush the clients.
INFO: telemetry.main: Finish splitting cli events and extra events, cli events: 1
INFO: telemetry.save: Save telemetry record of length 3966 in cache file under D:\a_work_temp.azclitask\telemetry\20250411051342446
INFO: telemetry.main: Begin creating telemetry upload process.
INFO: telemetry.process: Creating upload process: "C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\azure\cli\telemetry_init_.pyc D:\a_work_temp.azclitask D:\a_work_temp.azclitask\telemetry\20250411051342446"
INFO: telemetry.process: Return from creating process 2324
INFO: telemetry.main: Finish creating telemetry upload process.
##[error]Script failed with exit code: 1
C:\Windows\system32\cmd.exe /D /S /C ""C:\Program Files\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" account clear"
Finishing: Validating Bicep file (Resource Group scoped)
Additional context
No response