azure-cli: Error with Azure CLI 2.46.0 and Bicep if no bicep configuration exists
This is autogenerated. Please review and update as needed.
Describe the bug
Command Name
az bicep install
Errors:
Installing Bicep CLI v0.14.85...
The command failed with an unexpected error. Here is the traceback:
No section: 'bicep'
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 663, in execute
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 726, 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 697, in _run_job
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 333, in __call__
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/resource/custom.py", line 3648, in install_bicep_cli
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/resource/_bicep.py", line 141, in ensure_bicep_installation
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/config.py", line 99, in get
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/config.py", line 94, in get
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/config.py", line 208, in get
File "configparser.py", line 783, in get
File "configparser.py", line 1154, in _unify_values
configparser.NoSectionError: No section: 'bicep'
To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.
- install Azure CLI 2.46.0
az bicep install --version {}
Expected Behavior
No error if configuration is not set.
Environment Summary
Windows-10-10.0.17763-SP0
Python 3.10.10
Installer: MSI
azure-cli 2.46.0
Additional Context
This error also happens when running an az deployment
command passing a bicep file. It seems that the code is not resilient if no configuration for bicep is specified in the config file.
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 21
- Comments: 33 (1 by maintainers)
Commits related to this issue
- az config set bicep.use_binary_from_path=False https://github.com/Azure/azure-cli/issues/25710 — committed to martinkearn/sports-team-organiser by martinkearn a year ago
- Fix: build failure with cli upgrade https://github.com/Azure/azure-cli/issues/25710 — committed to Azure-Samples/serverless-webapp-kotlin by pankajagrawal16 a year ago
- 💚 Test suggested workaround for CI error (ab#104707) See https://github.com/Azure/azure-cli/issues/25710 — committed to equinor/data-marketplace-adapter-service by wenche a year ago
- https://github.com/Azure/azure-cli/issues/25710 — committed to hughjohnfrench/azure-nextflow by deleted user a year ago
I have the same problem, the installation works when I set:
az config set bicep.use_binary_from_path=False
. The problem occurs since version 2.46.0.@krizskp
I also have this problem when running the pipeline and
az deployment ...
command. I solved this problem by adding at the beginning:I haven’t tested yet how this would work with: az config set bicep.use_binary_from_path=if_found_in_ci
The error breaks automated deployment pipelines though. I use BitBucket Pipelines for deployment and face this same error message. The pipeline fails at this error message from
az deployment ...
command in the pipeline.Another workaround is to run the same az command twice, as the first time it will fail and the second time it succeeds.
I’m not seeing that issue but I put those two lines in their own PowerShell task and set standarderror to false and continueonerror to true because as long as they run (even failing) the next bicep command should work.
All deployments failing here as well, on an Agent in a deployment agent pool.
Temporary solution: Until fixed, downgrading version to az cli 2.45 seems to solve the issue. On agent VM run:
sudo apt-get install azure-cli=2.45.0-1~focal
Mind: when fixed, upgrade az cli again!
@qetza @kurt-mueller-osumc @dawidholka Thanks for the feedback! We have worked up a PR to address this.
Please do note that despite this error, the
bicep
CLI is installed and can be used as usual.I’ve tried the
az config
work around, and have now got our bit bucket pipelines working.Thanks @dawidholka! 😄
@dawidholka Thanks, didn’t get a chance to test it out since my pipelines seem to be working today. Hopefully the issue has been fixed globally.
This workaround works for me with AzureCLI@2 task and setting input:
useGlobalConfig: true
.I can confirm that I receive this same error when running inside an
aarch64
devcontainer. I’ve been installing azure cli via python sinceapt
apparently only supports thex86
architecture.Here are my specs: