Description
Describe the bug
When performing a bicep operation using the az cli in an Azure Devops Pipeline that has been upgraded to AZ CLI 2.71.x we seem to run in to the following:
FileNotFoundError: [Errno 2] No such file or directory: '/home/vsts/work/_temp/.azclitask/bin/bicep'
This is a problem on:
- Ubuntu 22.04 Self Hosted
- Ubuntu 24.04 Self Hosted
- Ubuntu 22.04 Microsoft Hosted Azure Pipelines - Ubuntu-22.04 pool.
This works because it runs AZ CLI 2.70
- task: AzureCLI@2
inputs:
azureSubscription: ${{ parameters.serviceConnection }}
scriptType: pscore
scriptLocation: inlineScript
workingDirectory: "$(System.DefaultWorkingDirectory)"
inlineScript: |
az deployment sub ${{ parameters.deploymentAction }} `
-f ./${{ parameters.bicepPath }}/main.bicep `
-p ./${{ parameters.bicepPath }}/parameters/main.${{ parameters.targetEnvironment }}.bicepparam `
-l ${{ parameters.location }} `
-n DeploymentXYZ`
--debug `
--verbose
This is broken because it gets upgraded to AZ CLI 2.71
- script: |
az upgrade --yes
displayName: Azure CLI Update
- task: AzureCLI@2
inputs:
azureSubscription: ${{ parameters.serviceConnection }}
scriptType: pscore
scriptLocation: inlineScript
workingDirectory: "$(System.DefaultWorkingDirectory)"
inlineScript: |
az deployment sub ${{ parameters.deploymentAction }} `
-f ./${{ parameters.bicepPath }}/main.bicep `
-p ./${{ parameters.bicepPath }}/parameters/main.${{ parameters.targetEnvironment }}.bicepparam `
-l ${{ parameters.location }} `
-n DeploymentXYZ`
--debug `
--verbose
Related command
az upgrade --yes
az deployment sub what-if with valid parameters
Errors
FileNotFoundError: [Errno 2] No such file or directory: '/home/vsts/work/_temp/.azclitask/bin/bicep'
Issue script & Debug output
2025-04-03T13:32:14.3037605Z DEBUG: cli.knack.cli: Command arguments: ['deployment', 'sub', 'what-if', '-f', './omittedforsecuritymain.bicep', '-p', './omittedforsecuritymain/main.dev.bicepparam', '-l', 'westeurope', '-n', 'omittedforsecuritymain', '--debug', '--verbose']
2025-04-03T13:32:14.3057707Z DEBUG: cli.knack.cli: init debug log:
2025-04-03T13:32:14.3058205Z Cannot enable color.
2025-04-03T13:32:14.3058680Z DEBUG: cli.knack.cli: Event: Cli.PreExecute []
2025-04-03T13:32:14.3059276Z DEBUG: cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x7f7d830db880>, <function OutputProducer.on_global_arguments at 0x7f7d82e82840>, <function CLIQuery.on_global_arguments at 0x7f7d82ed3d80>]
2025-04-03T13:32:14.3067573Z DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
2025-04-03T13:32:14.3080840Z DEBUG: cli.azure.cli.core: Modules found from index for 'deployment': ['azure.cli.command_modules.resource']
2025-04-03T13:32:14.3086211Z DEBUG: cli.azure.cli.core: Loading command modules:
2025-04-03T13:32:14.3090669Z DEBUG: cli.azure.cli.core: Name Load Time Groups Commands
2025-04-03T13:32:14.5249096Z DEBUG: cli.azure.cli.core: resource 0.214 52 232
2025-04-03T13:32:14.5249827Z DEBUG: cli.azure.cli.core: Total (1) 0.214 52 232
2025-04-03T13:32:14.5250260Z DEBUG: cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next']
2025-04-03T13:32:14.5250751Z DEBUG: cli.azure.cli.core: Loading extensions:
2025-04-03T13:32:14.5251086Z DEBUG: cli.azure.cli.core: Name Load Time Groups Commands Directory
2025-04-03T13:32:14.5253294Z DEBUG: cli.azure.cli.core: Total (0) 0.000 0 0
2025-04-03T13:32:14.5256661Z DEBUG: cli.azure.cli.core: Loaded 52 groups, 232 commands.
2025-04-03T13:32:14.5257086Z DEBUG: cli.azure.cli.core: Found a match in the command table.
2025-04-03T13:32:14.5258090Z DEBUG: cli.azure.cli.core: Raw command : deployment sub what-if
2025-04-03T13:32:14.5258446Z DEBUG: cli.azure.cli.core: Command table: deployment sub what-if
2025-04-03T13:32:14.5258817Z DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7f7d821682c0>]
2025-04-03T13:32:14.5259952Z DEBUG: cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/home/vsts/work/_temp/.azclitask/commands/2025-04-03.13-32-14.deployment_sub_what-if.2555.log'.
2025-04-03T13:32:14.5269372Z INFO: az_command_data_logger: command args: deployment sub what-if -f {} -p {} -l {} -n {} --debug --verbose
2025-04-03T13:32:14.5275495Z DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x7f7d821c07c0>]
2025-04-03T13:32:14.6545978Z DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
2025-04-03T13:32:14.6558467Z DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x7f7d821c2fc0>, <function register_cache_arguments..add_cache_arguments at 0x7f7d821c3100>, <function register_upcoming_breaking_change_info..update_breaking_change_info at 0x7f7d821c31a0>]
2025-04-03T13:32:14.6568699Z DEBUG: cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
2025-04-03T13:32:14.6569825Z DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
2025-04-03T13:32:14.6582371Z DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7f7d82e828e0>, <function CLIQuery.handle_query_parameter at 0x7f7d82ed3e20>, <function register_ids_argument..parse_ids_arguments at 0x7f7d821c3060>]
2025-04-03T13:32:14.6589570Z DEBUG: cli.azure.cli.command_modules.resource._bicep: Current value of "use_binary_from_path": if_found_in_ci.
2025-04-03T13:32:14.6596600Z DEBUG: cli.azure.cli.command_modules.resource._bicep: Running in a CI environment. Bicep CLI available on PATH: True.
2025-04-03T13:32:14.7038029Z DEBUG: cli.azure.cli.core.azclierror: Traceback (most recent call last):
2025-04-03T13:32:14.7038315Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 703, in _run_job
2025-04-03T13:32:14.7038528Z result = cmd_copy(params)
2025-04-03T13:32:14.7038792Z ^^^^^^^^^^^^^^^^
2025-04-03T13:32:14.7038990Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 336, in call
2025-04-03T13:32:14.7039271Z return self.handler(*args, **kwargs)
2025-04-03T13:32:14.7039429Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-04-03T13:32:14.7039940Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 120, in handler
2025-04-03T13:32:14.7040160Z return op(**command_args)
2025-04-03T13:32:14.7040484Z ^^^^^^^^^^^^^^^^^^
2025-04-03T13:32:14.7040705Z File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/resource/custom.py", line 882, in what_if_deploy_arm_template_at_subscription_scope
2025-04-03T13:32:14.7041123Z return _what_if_deploy_arm_template_at_subscription_scope_core(cmd,
2025-04-03T13:32:14.7041478Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-04-03T13:32:14.7041718Z File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/resource/custom.py", line 895, in _what_if_deploy_arm_template_at_subscription_scope_core
2025-04-03T13:32:14.7042197Z what_if_properties = _prepare_deployment_what_if_properties(cmd, 'subscription', template_file, template_uri, parameters,
2025-04-03T13:32:14.7042415Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-04-03T13:32:14.7042959Z File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/resource/custom.py", line 1193, in _prepare_deployment_what_if_properties
2025-04-03T13:32:14.7043456Z deployment_properties = _prepare_deployment_properties_unmodified(cmd, deployment_scope, template_file=template_file, template_uri=template_uri,
2025-04-03T13:32:14.7043794Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-04-03T13:32:14.7044029Z File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/resource/custom.py", line 1146, in _prepare_deployment_properties_unmodified
2025-04-03T13:32:14.7044543Z template_content, template_spec_id, bicepparam_json_content = _parse_bicepparam_file(cmd, template_file, parameters)
2025-04-03T13:32:14.7044771Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-04-03T13:32:14.7045318Z File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/resource/custom.py", line 1072, in _parse_bicepparam_file
2025-04-03T13:32:14.7045647Z if not bicep_version_greater_than_or_equal_to(minimum_supported_version_bicepparam_compilation):
2025-04-03T13:32:14.7046049Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-04-03T13:32:14.7046304Z File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/resource/_bicep.py", line 226, in bicep_version_greater_than_or_equal_to
2025-04-03T13:32:14.7046761Z installed_version = _get_bicep_installed_version(installation_path)
2025-04-03T13:32:14.7046956Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-04-03T13:32:14.7047352Z File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/resource/_bicep.py", line 291, in _get_bicep_installed_version
2025-04-03T13:32:14.7047922Z installed_version_output = _run_command(bicep_executable_path, ["--version"])
2025-04-03T13:32:14.7048115Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-04-03T13:32:14.7048325Z File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/resource/_bicep.py", line 360, in _run_command
2025-04-03T13:32:14.7048543Z process = subprocess.run(
2025-04-03T13:32:14.7048696Z ^^^^^^^^^^^^^^^
2025-04-03T13:32:14.7049021Z File "/opt/az/lib/python3.12/subprocess.py", line 548, in run
2025-04-03T13:32:14.7049385Z with Popen(*popenargs, **kwargs) as process:
2025-04-03T13:32:14.7049542Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-04-03T13:32:14.7049708Z File "/opt/az/lib/python3.12/subprocess.py", line 1026, in init
2025-04-03T13:32:14.7049911Z self._execute_child(args, executable, preexec_fn, close_fds,
2025-04-03T13:32:14.7050131Z File "/opt/az/lib/python3.12/subprocess.py", line 1955, in _execute_child
2025-04-03T13:32:14.7050344Z raise child_exception_type(errno_num, err_msg, err_filename)
2025-04-03T13:32:14.7050568Z FileNotFoundError: [Errno 2] No such file or directory: '/home/vsts/work/_temp/.azclitask/bin/bicep'
2025-04-03T13:32:14.7050672Z
2025-04-03T13:32:14.7050842Z During handling of the above exception, another exception occurred:
2025-04-03T13:32:14.7050927Z
2025-04-03T13:32:14.7051072Z Traceback (most recent call last):
2025-04-03T13:32:14.7051305Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/arm.py", line 109, in handle_template_based_exception
2025-04-03T13:32:14.7051536Z raise CLIError(ex.inner_exception.error.message)
2025-04-03T13:32:14.7051697Z ^^^^^^^^^^^^^^^^^^
2025-04-03T13:32:14.7051876Z AttributeError: 'FileNotFoundError' object has no attribute 'inner_exception'
2025-04-03T13:32:14.7051969Z
2025-04-03T13:32:14.7052135Z During handling of the above exception, another exception occurred:
2025-04-03T13:32:14.7052323Z
2025-04-03T13:32:14.7052478Z Traceback (most recent call last):
2025-04-03T13:32:14.7052670Z File "/opt/az/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke
2025-04-03T13:32:14.7052867Z cmd_result = self.invocation.execute(args)
2025-04-03T13:32:14.7053025Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-04-03T13:32:14.7053213Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 666, in execute
2025-04-03T13:32:14.7053399Z raise ex
2025-04-03T13:32:14.7053598Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 734, in _run_jobs_serially
2025-04-03T13:32:14.7053825Z results.append(self._run_job(expanded_arg, cmd_copy))
2025-04-03T13:32:14.7053990Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-04-03T13:32:14.7054179Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 726, in _run_job
2025-04-03T13:32:14.7054384Z return cmd_copy.exception_handler(ex)
2025-04-03T13:32:14.7054544Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-04-03T13:32:14.7054748Z File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/arm.py", line 114, in handle_template_based_exception
2025-04-03T13:32:14.7057192Z raise CLIError(ex)
2025-04-03T13:32:14.7057429Z knack.util.CLIError: [Errno 2] No such file or directory: '/home/vsts/work/_temp/.azclitask/bin/bicep'
2025-04-03T13:32:14.7057549Z
2025-04-03T13:32:14.7105226Z ERROR: cli.azure.cli.core.azclierror: [Errno 2] No such file or directory: '/home/vsts/work/_temp/.azclitask/bin/bicep'
2025-04-03T13:32:14.7108545Z ERROR: az_command_data_logger: [Errno 2] No such file or directory: '/home/vsts/work/_temp/.azclitask/bin/bicep'
2025-04-03T13:32:14.7112301Z DEBUG: cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7f7d82168540>]
2025-04-03T13:32:14.7112538Z INFO: az_command_data_logger: exit code: 1
2025-04-03T13:32:14.7114803Z INFO: cli.main: Command ran in 0.578 seconds (init: 0.170, invoke: 0.408)
2025-04-03T13:32:14.7958716Z INFO: telemetry.main: Begin splitting cli events and extra events, total events: 1
2025-04-03T13:32:14.7963186Z INFO: telemetry.client: Accumulated 0 events. Flush the clients.
2025-04-03T13:32:14.7963775Z INFO: telemetry.main: Finish splitting cli events and extra events, cli events: 1
2025-04-03T13:32:14.7964204Z INFO: telemetry.save: Save telemetry record of length 3971 in cache file under /home/vsts/work/_temp/.azclitask/telemetry/20250403133214795
2025-04-03T13:32:14.7968123Z INFO: telemetry.main: Begin creating telemetry upload process.
2025-04-03T13:32:14.7968742Z INFO: telemetry.process: Creating upload process: "/opt/az/bin/python3 /opt/az/lib/python3.12/site-packages/azure/cli/telemetry/init.py /home/vsts/work/_temp/.azclitask /home/vsts/work/_temp/.azclitask/telemetry/20250403133214795"
2025-04-03T13:32:14.7995395Z INFO: telemetry.process: Return from creating process 2561
2025-04-03T13:32:14.7996863Z INFO: telemetry.main: Finish creating telemetry upload process.
2025-04-03T13:32:14.9512311Z ##[debug]$LASTEXITCODE: 1
Expected behavior
Does a correct bicep what-if and doesn't throw error.
Environment Summary
/usr/bin/az --version
azure-cli 2.71.0
core 2.71.0
telemetry 1.1.0
Extensions:
azure-devops 1.0.1
Dependencies:
msal 1.31.2b1
azure-mgmt-resource 23.1.1
Python location '/opt/az/bin/python3'
Config directory '/home/vsts/.azure'
Extensions directory '/opt/az/azcliextensions'
Python (Linux) 3.12.8 (main, Mar 25 2025, 10:54:53) [GCC 11.4.0]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
Additional context
No response