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

Azure CLI: API version 2022-05-01 does not have operation group 'storage_accounts' #23821

Closed
qTipTip opened this issue Sep 8, 2022 · 12 comments
Assignees
Labels
Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Storage az storage
Milestone

Comments

@qTipTip
Copy link

qTipTip commented Sep 8, 2022

Hello!

Describe the bug

Command Name
az storage blob upload

Errors:

Server failed to authenticate the request. Please refer to the information in the www-authenticate header.
RequestId:f56786d2-c01e-004b-5a6d-c38f55000000
Time:2022-09-08T10:25:19.9002276Z
ErrorCode:NoAuthenticationInformation

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • az login --service-principal --username {} --tenant {} --password {}
  • az storage blob upload -f {} -c {} -n {} --account-name {} --subscription {} --auth-mode key

Expected Behavior

That the storage blob uploads successfully.

Environment Summary

Linux-5.4.0-1086-azure-x86_64-with-debian-10.12, Debian GNU/Linux 10 (buster)
Python 3.7.14
Installer: PIP

azure-cli 2.40.0

Additional Context

We had to upgrade from azure-cli version 2.36 to azure-cli version 2.40 due to a regression bug. We are now experiencing the aforementioned error and this is directly impacting our users. The CLI is authenticated using a service principal and has previously worked.

@ghost ghost added customer-reported Issues that are reported by GitHub users external to the Azure organization. Storage az storage labels Sep 8, 2022
@ghost ghost added this to the Backlog milestone Sep 8, 2022
@ghost ghost assigned evelyn-ys Sep 8, 2022
@ghost ghost added the Auto-Assign Auto assign by bot label Sep 8, 2022
@yonzhan yonzhan added Azure CLI Team The command of the issue is owned by Azure CLI team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Sep 8, 2022
@yonzhan
Copy link
Collaborator

yonzhan commented Sep 8, 2022

@evelyn-ys for awareness

@andrescodas
Copy link

I'm facing the same issue. Is there any fix?

@evelyn-ys
Copy link
Member

By specifying --auth-mode key, please provide --account-key together with --account-name.

Can you share the debug log if still have problems after adding --account-key?

@yonzhan yonzhan added the CXP Attention This issue is handled by CXP team. label Sep 21, 2022
@ghost
Copy link

ghost commented Sep 21, 2022

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

@andrescodas
Copy link

andrescodas commented Sep 21, 2022

The point is that I'm using az-cli to get the key. Here is what I see:

$ az storage account keys list --account-name "${STORAGE_NAME}" --subscription "${SUBSCRIPTION_NAME}"
Auto upgrade failed. name 'exit_code' is not defined
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/local/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 561, in execute
    self.commands_loader.load_arguments(command)
  File "/usr/local/lib/python3.8/site-packages/azure/cli/core/__init__.py", line 507, in load_arguments
    self.command_table[command].load_arguments()  # this loads the arguments via reflection
  File "/usr/local/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 318, in load_arguments
    super(AzCliCommand, self).load_arguments()
  File "/usr/local/lib/python3.8/site-packages/knack/commands.py", line 104, in load_arguments
    cmd_args = self.arguments_loader()
  File "/usr/local/lib/python3.8/site-packages/azure/cli/core/commands/command_operation.py", line 125, in arguments_loader
    op = self.get_op_handler(self.op_path)
  File "/usr/local/lib/python3.8/site-packages/azure/cli/core/commands/command_operation.py", line 59, in get_op_handler
    handler = import_module(mod_to_import)
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'azure.mgmt.storage.v2022_05_01'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.8/site-packages/azure/cli/__main__.py", line 49, in <module>
    exit_code = cli_main(az_cli, sys.argv[1:])
  File "/usr/local/lib/python3.8/site-packages/azure/cli/__main__.py", line 36, in cli_main
    return cli.invoke(args)
  File "/usr/local/lib/python3.8/site-packages/knack/cli.py", line 243, in invoke
    exit_code = self.exception_handler(ex)
  File "/usr/local/lib/python3.8/site-packages/azure/cli/core/__init__.py", line 127, in exception_handler
    return handle_exception(ex)
  File "/usr/local/lib/python3.8/site-packages/azure/cli/core/util.py", line 64, in handle_exception
    from msal_extensions.persistence import PersistenceError
ImportError: cannot import name 'PersistenceError' from 'msal_extensions.persistence' (/usr/local/lib/python3.8/site-packages/msal_extensions/persistence.py)
$ az --version
azure-cli                         2.40.0

core                              2.40.0
telemetry                          1.0.8

Extensions:
azure-cli-ml                      1.41.0

Dependencies:
msal                            1.18.0b1
azure-mgmt-resource             21.1.0b1

Python location '/usr/local/bin/python'
Extensions directory '/home/XXXX/.azure/cliextensions'

Python (Linux) 3.8.13 (default, May 28 2022, 14:23:53) 
[GCC 10.2.1 20210110]

Legal docs and information: aka.ms/AzureCliLegal


Your CLI is up-to-date

@evelyn-ys
Copy link
Member

Seems like some dependencies are missing(azure-mgmt-storage, msal, etc) during auto upgrade. Can you install latest CLI manually following https://learn.microsoft.com/en-us/cli/azure/install-azure-cli

@andrescodas
Copy link

Hi @evelyn-ys

This is how I installed az-cli:

curl -sL https://aka.ms/InstallAzureCLIDeb | bash

this is how I attempt to updated it:

$ az upgrade
This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
You already have the latest azure-cli version: 2.40.0
Upgrading extensions
Checking update for storage-preview
Latest version of 'storage-preview' is already installed.

Use --debug for more information
Upgrade finished.You can enable auto-upgrade with 'az config set auto-upgrade.enable=yes'. More details in https://docs.microsoft.com/cli/azure/update-azure-cli#automatic-update
$ az storage account keys list --account-name "${STORAGE_NAME}" --subscription "${SUBSCRIPTION_NAME}"
Auto upgrade failed. name 'exit_code' is not defined
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/local/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 561, in execute
    self.commands_loader.load_arguments(command)
  File "/usr/local/lib/python3.8/site-packages/azure/cli/core/__init__.py", line 507, in load_arguments
    self.command_table[command].load_arguments()  # this loads the arguments via reflection
  File "/usr/local/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 318, in load_arguments
    super(AzCliCommand, self).load_arguments()
  File "/usr/local/lib/python3.8/site-packages/knack/commands.py", line 104, in load_arguments
    cmd_args = self.arguments_loader()
  File "/usr/local/lib/python3.8/site-packages/azure/cli/core/commands/command_operation.py", line 125, in arguments_loader
    op = self.get_op_handler(self.op_path)
  File "/usr/local/lib/python3.8/site-packages/azure/cli/core/commands/command_operation.py", line 59, in get_op_handler
    handler = import_module(mod_to_import)
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'azure.mgmt.storage.v2022_05_01'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.8/site-packages/azure/cli/__main__.py", line 49, in <module>
    exit_code = cli_main(az_cli, sys.argv[1:])
  File "/usr/local/lib/python3.8/site-packages/azure/cli/__main__.py", line 36, in cli_main
    return cli.invoke(args)
  File "/usr/local/lib/python3.8/site-packages/knack/cli.py", line 243, in invoke
    exit_code = self.exception_handler(ex)
  File "/usr/local/lib/python3.8/site-packages/azure/cli/core/__init__.py", line 127, in exception_handler
    return handle_exception(ex)
  File "/usr/local/lib/python3.8/site-packages/azure/cli/core/util.py", line 64, in handle_exception
    from msal_extensions.persistence import PersistenceError
ImportError: cannot import name 'PersistenceError' from 'msal_extensions.persistence' (/usr/local/lib/python3.8/site-packages/msal_extensions/persistence.py)

Can you send the specific updates I need to use to update? I use a linux-debian environment

@andrescodas
Copy link

I think I found the issue. There is a conflict with other packages I install:

python -m pip install --no-cache-dir --upgrade pip \
 && python -m pip install --no-cache-dir --upgrade "azure-ml-component[notebooks]" \
 && python -m pip install --no-cache-dir --upgrade azureml-dataset-runtime[fuse] \
 && az extension add --source https://azuremlsdktestpypi.blob.core.windows.net/wheels/componentsdk/azure_cli_ml-0.9.13-py3-none-any.whl --pip-extra-index-urls https://azuremlsdktestpypi.azureedge.net/componentsdk/0.9.13 --yes --verbose

After installing these, I start seeing the error above

@evelyn-ys
Copy link
Member

Sounds like known issue of ml extension conflict. @jiasli may have more knowledge

@jiasli
Copy link
Member

jiasli commented Sep 26, 2022

https://aka.ms/InstallAzureCLIDeb installs Azure CLI DEB package at /opt/az, but your Azure CLI was installed with pip judging by the installation location:

/usr/local/lib/python3.8/site-packages/azure/cli

We recommend installing the Azure CLI DEB package, but if you have to use pip, we recommend installing to a virtual environment. See #20476 (comment).

Please be aware that installing from pip is not officially supported.

@PramodValavala-MSFT PramodValavala-MSFT removed the CXP Attention This issue is handled by CXP team. label Oct 6, 2022
@johnathon-b
Copy link

johnathon-b commented Feb 8, 2023

https://aka.ms/InstallAzureCLIDeb installs Azure CLI DEB package at /opt/az, but your Azure CLI was installed with pip judging by the installation location:

/usr/local/lib/python3.8/site-packages/azure/cli

We recommend installing the Azure CLI DEB package, but if you have to use pip, we recommend installing to a virtual environment. See #20476 (comment).

Please be aware that installing from pip is not officially supported.

This same error is happening for az storage on Microsoft hosted build agents.. We don't control how the az cli is installed. Updating the cli to latest doesn't fix the issue.

This broke a lot of our pipelines this week.

WARNING: 
There are no credentials provided in your command and environment, we will query for account key for your storage account.
It is recommended to provide --connection-string, --account-key or --sas-token in your command as credentials.

You also can add `--auth-mode login` in your command to use Azure Active Directory (Azure AD) for authorization if your login account is assigned required RBAC roles.
For more information about RBAC roles in storage, visit https://docs.microsoft.com/azure/storage/common/storage-auth-aad-rbac-cli.

In addition, setting the corresponding environment variables can avoid inputting credentials in your command. Please use --help to get more information about environment variable usage.

@johnathon-b
Copy link

Azure DevOps Task:

Starting: Deploy Client Files
==============================================================================
Task         : Azure CLI
Description  : Run Azure CLI commands against an Azure subscription in a PowerShell Core/Shell script when running on Linux agent or PowerShell/PowerShell Core/Batch script when running on Windows agent.
Version      : 2.216.0
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-cli
==============================================================================
/usr/bin/az --version
WARNING: You have 2 update(s) available. Consider updating your CLI installation with 'az upgrade'
azure-cli                         2.44.1 *

core                              2.44.1 *
telemetry                          1.0.8

Dependencies:
msal                              1.20.0
azure-mgmt-resource             21.1.0b1

Python location '/opt/az/bin/python3'
Extensions directory '/root/.azure/cliextensions'

Python (Linux) 3.10.8 (main, Jan 10 2023, 15:48:33) [GCC 9.4.0]

Legal docs and information: aka.ms/AzureCliLegal


Setting AZURE_CONFIG_DIR env variable to: /opt/azdo/_work/_temp/.azclitask

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Storage az storage
Projects
None yet
Development

No branches or pull requests

7 participants