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

az sql server list giving CLIInternalError on arm64/amd64 #19772

Open
kierenj opened this issue Oct 4, 2021 · 5 comments
Open

az sql server list giving CLIInternalError on arm64/amd64 #19772

kierenj opened this issue Oct 4, 2021 · 5 comments
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. Service Attention This issue is responsible by Azure service team. SQL az sql

Comments

@kierenj
Copy link

kierenj commented Oct 4, 2021

Describe the bug
az sql server list results in:

ERROR: CLIInternalError: The command failed with an unexpected error. Here is the traceback:
ERROR: cannot import name 'ImportExistingDatabaseDefinition' from 'azure.mgmt.sql.models' (/usr/lib/python3/dist-packages/azure/mgmt/sql/models/__init__.py)
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/knack/cli.py", line 233, in invoke   
    cmd_result = self.invocation.execute(args)
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 558, in execute 
    self.commands_loader.load_arguments(command)
  File "/usr/lib/python3/dist-packages/azure/cli/core/__init__.py", line 481, in load_arguments
    loader.load_arguments(command)  # this adds entries to the argument registries 
  File "/usr/lib/python3/dist-packages/azure/cli/command_modules/sql/__init__.py", line 27, in load_arguments
    from azure.cli.command_modules.sql._params import load_arguments   
  File "/usr/lib/python3/dist-packages/azure/cli/command_modules/sql/_params.py", line 11, in <module>   
    from azure.mgmt.sql.models import (
ImportError: cannot import name 'ImportExistingDatabaseDefinition' from 'azure.mgmt.sql.models' (/usr/lib/python3/dist-packages/azure/mgmt/sql/models/__init__.py)

To Reproduce
ARM64 arch. EDIT: Also occurs on the AMD64 version of image, so not ARM64 specific. Dockerfile:

FROM debian:bullseye

RUN apt-get update
RUN apt-get install --yes python3 python3-pip
RUN apt install --yes azure-cli

I then run a script which does:

  1. az login with username, password, tenant for a service principal - works
  2. az account set --subscription "my sub here" - works
  3. az sql server list - fails as above

Expected behavior
List of servers returned, as works with mcr.microsoft.com/azure-cli:latest image (on amd64 it works... arm64 build is broken)

Environment summary

  • arm64 arch, or amd64 arch
  • kubernetes
  • debian:bullseye
  • latest azure-cli installed via apt as above
@ghost ghost added needs-triage This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that customer-reported Issues that are reported by GitHub users external to the Azure organization. labels Oct 4, 2021
@yonzhan yonzhan added the SQL az sql label Oct 4, 2021
@ghost ghost removed the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Oct 4, 2021
@yonzhan yonzhan added Service Attention This issue is responsible by Azure service team. and removed question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Oct 4, 2021
@ghost
Copy link

ghost commented Oct 4, 2021

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @azureSQLGitHub.

Issue Details

Describe the bug
az sql server list results in:

ERROR: CLIInternalError: The command failed with an unexpected error. Here is the traceback:
ERROR: cannot import name 'ImportExistingDatabaseDefinition' from 'azure.mgmt.sql.models' (/usr/lib/python3/dist-packages/azure/mgmt/sql/models/__init__.py)
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/knack/cli.py", line 233, in invoke   
    cmd_result = self.invocation.execute(args)
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 558, in execute 
    self.commands_loader.load_arguments(command)
  File "/usr/lib/python3/dist-packages/azure/cli/core/__init__.py", line 481, in load_arguments
    loader.load_arguments(command)  # this adds entries to the argument registries 
  File "/usr/lib/python3/dist-packages/azure/cli/command_modules/sql/__init__.py", line 27, in load_arguments
    from azure.cli.command_modules.sql._params import load_arguments   
  File "/usr/lib/python3/dist-packages/azure/cli/command_modules/sql/_params.py", line 11, in <module>   
    from azure.mgmt.sql.models import (
ImportError: cannot import name 'ImportExistingDatabaseDefinition' from 'azure.mgmt.sql.models' (/usr/lib/python3/dist-packages/azure/mgmt/sql/models/__init__.py)

To Reproduce
ARM64 arch. Dockerfile:

FROM debian:bullseye

RUN apt-get update
RUN apt-get install --yes python3 python3-pip
RUN apt install --yes azure-cli

I then run a script which does:

  1. az login with username, password, tenant for a service principal - works
  2. az account set --subscription "my sub here" - works
  3. az sql server list - fails as above

Expected behavior
List of servers returned, as works with mcr.microsoft.com/azure-cli:latest image (on amd64 it works... arm64 build is broken)

Environment summary

  • arm64 arch
  • kubernetes
  • debian:bullseye
  • latest azure-cli installed via apt as above
Author: kierenj
Assignees: -
Labels:

SQL, Service Attention, customer-reported

Milestone: -

@yonzhan
Copy link
Collaborator

yonzhan commented Oct 4, 2021

route to service team

@kierenj kierenj changed the title az sql server list giving CLIInternalError on arm64 az sql server list giving CLIInternalError on arm64/amd64 Oct 5, 2021
@kierenj
Copy link
Author

kierenj commented Oct 6, 2021

This is specific to 'bullseye' debian, despite that being the latest stable release.

This seems to work fine for 'buster':

FROM debian:buster

RUN apt-get update
RUN apt-get install --yes ca-certificates curl apt-transport-https lsb-release gnupg
RUN curl -sL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | tee /etc/apt/trusted.gpg.d/microsoft.gpg > /dev/null
RUN echo "deb [arch=$(dpkg --print-architecture)] https://packages.microsoft.com/repos/azure-cli/ buster main" | tee /etc/apt/sources.list.d/azure-cli.list
RUN apt-get update
RUN apt-get install --yes azure-cli

@kierenj
Copy link
Author

kierenj commented Oct 6, 2021

I spoke too soon. On arm64:

/usr/bin/az: line 3: /usr/bin/../../opt/az/bin/python3: cannot execute binary file: Exec format error

@kierenj
Copy link
Author

kierenj commented Oct 6, 2021

This worked:

#7368 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. Service Attention This issue is responsible by Azure service team. SQL az sql
Projects
None yet
Development

No branches or pull requests

2 participants