Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with Azure CLI 2.46.0 and Bicep if no bicep configuration exists #25710

Closed
qetza opened this issue Mar 7, 2023 · 33 comments · Fixed by #25729
Closed

Error with Azure CLI 2.46.0 and Bicep if no bicep configuration exists #25710

qetza opened this issue Mar 7, 2023 · 33 comments · Fixed by #25729
Assignees
Labels
ARM az resource/group/lock/tag/deployment/policy/managementapp/account management-group Auto-Assign Auto assign by bot bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. CXP Attention This issue is handled by CXP team.
Milestone

Comments

@qetza
Copy link

qetza commented Mar 7, 2023

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.

@ghost ghost added customer-reported Issues that are reported by GitHub users external to the Azure organization. Auto-Assign Auto assign by bot ARM az resource/group/lock/tag/deployment/policy/managementapp/account management-group labels Mar 7, 2023
@ghost ghost assigned zhoxing-ms Mar 7, 2023
@ghost ghost added this to the Backlog milestone Mar 7, 2023
@ghost ghost added the Installation label Mar 7, 2023
@ghost ghost assigned jiasli Mar 7, 2023
@yonzhan yonzhan added CXP Attention This issue is handled by CXP team. and removed Installation labels Mar 7, 2023
@ghost
Copy link

ghost commented Mar 7, 2023

Thank you for your feedback. This has been routed to the support team for assistance.

@yonzhan
Copy link
Collaborator

yonzhan commented Mar 7, 2023

route to CXP team

@kurt-mueller-osumc
Copy link

I can confirm that I receive this same error when running inside an aarch64 devcontainer. I've been installing azure cli via python since apt apparently only supports the x86 architecture.

Here are my specs:

Version: 1.77.0-insider
Commit: bbc87d8ec2453f12c0066e1c30b41cd5bd2aa021
Date: 2023-03-07T05:36:47.728Z
Electron: 19.1.11
Chromium: 102.0.5005.196
Node.js: 16.14.2
V8: 10.2.154.26-electron.0
OS: Darwin arm64 22.3.0
Sandboxed: Yes

@dawidholka
Copy link

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.

@PramodValavala-MSFT PramodValavala-MSFT self-assigned this Mar 8, 2023
@PramodValavala-MSFT PramodValavala-MSFT added bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. labels Mar 8, 2023
@PramodValavala-MSFT
Copy link
Contributor

@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.

@krizskp
Copy link

krizskp commented Mar 8, 2023

@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.

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.

@dawidholka
Copy link

dawidholka commented Mar 8, 2023

@krizskp

@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.

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.

I also have this problem when running the pipeline and az deployment ... command. I solved this problem by adding at the beginning:

az config set bicep.use_binary_from_path=False
az bicep install

I haven't tested yet how this would work with:
az config set bicep.use_binary_from_path=if_found_in_ci

@michaelelleby
Copy link

@krizskp

@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.

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.

I also have this problem when running the pipeline and az deployment ... command. I solved this problem by adding at the beginning:

az config set bicep.use_binary_from_path=False
az bicep install

I haven't tested yet how this would work with: az config set bicep.use_binary_from_path=if_found_in_ci

Another workaround is to run the same az command twice, as the first time it will fail and the second time it succeeds.

@KarenTazayan
Copy link

The same error breaks my Azure Pipelines when build agents upgraded to Azure CLI 2.46.0.

@Sumtin
Copy link

Sumtin commented Mar 10, 2023

Breaking Azure Pipeline builds for me too. Tried workaround but still breaking. Currently can't deploy any of my infra from Pipelines. What's the timeframe for the fix?

@Sdelausnay
Copy link

We have the same issue on our agents. Workaround also don't seem to do the trick for use. Any news on the topic?

@sb1975
Copy link

sb1975 commented Mar 10, 2023

Same error, resolved by using inline script in additional Task before running the main Task.
inlineScript: |
az config set bicep.use_binary_from_path=False
az bicep install

@ashugthub
Copy link

I am facing same issue bicep install fails. even after setting az config set bicep.use_binary_from_path=False , it produces warning on the console and build fails.

@vishnuss10308
Copy link

vishnuss10308 commented Mar 13, 2023

I am also facing the same issue in GitLab Pipelines
az deployment group create command is failing with error
ERROR: No section: 'bicep'
Retry worked for az deployment group validate command for the same parameters.

Update: az deployment group create command worked after 4 retries

@TenaciousG
Copy link

This is also breaking my Azure Pipelines. Cannot deploy production changes!

martinkearn added a commit to martinkearn/sports-team-organiser that referenced this issue Mar 16, 2023
@TenaciousG
Copy link

@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.

@danielmackay
Copy link

I've tried the az config work around, and have now got our bit bucket pipelines working.

Thanks @dawidholka! 😄

@johnnyreilly
Copy link

Seeing this also on GitHub Actions deployments for my Azure Static Web App blog. Failing build: https://github.com/johnnyreilly/blog.johnnyreilly.com/actions/runs/4433656682/jobs/7810249789?pr=459

PR that triggered this: johnnyreilly/blog.johnnyreilly.com#459

@PNeergaard
Copy link

PNeergaard commented Mar 17, 2023

We found that this issue may be related to the fact that Bicep is already installed on the agent running the build i.e. if running windows-latest in Azure DevOps. If we remove our "az bicep install" step, deployments run without any issues.

@ugreg
Copy link
Member

ugreg commented Mar 17, 2023

Anyone facing this issue when trying to set to false, it causes any Azure Pipelines to fail.

az config set bicep.use_binary_from_path=false
az bicep install

image

@thisjustin816
Copy link

Anyone facing this issue when trying to set to false, it causes any Azure Pipelines to fail.

az config set bicep.use_binary_from_path=false

az bicep install

image

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.

@ugreg
Copy link
Member

ugreg commented Mar 17, 2023

Thanks adding those two lines in their own PowerShell task worked.

Example

- task: PowerShell@2
  displayName: "Install Bicep"
  inputs:
    targetType: 'inline'
    script: |         
          az config set bicep.use_binary_from_path=false
          az bicep install
    failOnStderr: false
    showWarnings: true
    pwsh: true

@m-soltani
Copy link

This is an extra burden for us when writing CI/CD pipelines, which is now broken due to this functionality. I have to add the flag use_binary_from_path=False and install Bicep CLI manually, which is really nasty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ARM az resource/group/lock/tag/deployment/policy/managementapp/account management-group Auto-Assign Auto assign by bot bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. CXP Attention This issue is handled by CXP team.
Projects
None yet