Skip to content

bicep publish seems to be broken #26241

@GeraldGoldstein

Description

@GeraldGoldstein

az feedback auto-generates most of the information requested below, as of CLI version 2.0.62

Running bicep publish in ADO fails, however doing it from devcontainer or PowerShell session locally works. FYI. we are using the bicep module from here aka.ms/carml.

Related command
variables:
spn: SC-ContainerRegistry
CarmlVersionNumber: 0.10.0
RegistryName: xxxxcarmlbicep.azurecr.io

  - task: AzureCLI@2
    displayName: Publish user assigned identity module.
    inputs:
      azureSubscription: $(spn)
      scriptType: 'bash'
      scriptLocation: 'inlineScript'
      inlineScript: |
        az bicep publish \
        --file modules/Microsoft.ManagedIdentity/userAssignedIdentities/deploy.bicep \
        --target br:$(RegistryName)/bicep/modules/microsoft.managedidentity/user_assigned_identities:$(CarmlVersionNumber) \

Describe the bug
ERROR: The command failed with an unexpected error. Here is the traceback:
ERROR: [Errno 2] No such file or directory: '/home/vsts/work/_temp/.azclitask/bin/bicep'
Traceback (most recent call last):
File "/opt/az/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 663, in execute
raise ex
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 726, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 697, in _run_job
result = cmd_copy(params)
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 333, in call
return self.handler(*args, **kwargs)
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
return op(**command_args)
File "/opt/az/lib/python3.10/site-packages/azure/cli/command_modules/resource/custom.py", line 3779, in publish_bicep_file
if bicep_version_greater_than_or_equal_to(minimum_supported_version):
File "/opt/az/lib/python3.10/site-packages/azure/cli/command_modules/resource/_bicep.py", line 202, in bicep_version_greater_than_or_equal_to
installed_version = _get_bicep_installed_version(installation_path)
File "/opt/az/lib/python3.10/site-packages/azure/cli/command_modules/resource/_bicep.py", line 273, in _get_bicep_installed_version
installed_version_output = _run_command(bicep_executable_path, ["--version"])
File "/opt/az/lib/python3.10/site-packages/azure/cli/command_modules/resource/_bicep.py", line 311, in _run_command
process = subprocess.run([rf"{bicep_installation_path}"] + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
File "/opt/az/lib/python3.10/subprocess.py", line 503, in run
with Popen(*popenargs, **kwargs) as process:
File "/opt/az/lib/python3.10/subprocess.py", line 971, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "/opt/az/lib/python3.10/subprocess.py", line 1847, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/home/vsts/work/_temp/.azclitask/bin/bicep'
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues
To open a new issue, please run az feedback
##[error]Script failed with exit code: 1
/usr/bin/az account clear
Finishing: Publish user assigned identity module.

To Reproduce
running the publish command from ado agent throws this error, have repo'ed this is multiple tenants.

Expected behavior
publish command should complete with a success message that the module was published to the registry, all previous bicep version have been working, but not v15 and v16.

this ERROR was happening in bicep v15 but then there was a fix added which worked around this issue. that is no longer working.
fix was to add these lines to the ADO agent:
az bicep uninstall
az config set bicep.use_binary_from_path=false
az bicep install

Environment summary
take any bicep module, create a simple ADO pipeline, put in there an az cli task to publish the module and watch it fail.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    ARM - TemplatesAuto-AssignAuto assign by botService AttentionThis issue is responsible by Azure service team.act-identity-squadcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions