Homebrew / homebrew-core

🍻 Default formulae for the missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
13.77k stars 12.45k forks source link

azure-cli doesn't appear to have the `azure-graphrbac` library installed #197606

Open spkane opened 1 day ago

spkane commented 1 day ago

brew gist-logs <formula> link OR brew config AND brew doctor output

$ brew gist-logs azure-cli
Error: No logs.

$ brew config
HOMEBREW_VERSION: 4.4.5
ORIGIN: https://github.com/Homebrew/brew
HEAD: 254bf3fe9d8fa2e1b2fb55dbcf535b2d870180c4
Last commit: 2 days ago
Core tap JSON: 13 Nov 18:17 UTC
Core cask tap JSON: 13 Nov 18:17 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: :0
HOMEBREW_EDITOR: vim
HOMEBREW_GITHUB_API_TOKEN: set
HOMEBREW_MAKE_JOBS: 12
Homebrew Ruby: 3.3.6 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.6/bin/ruby
CPU: dodeca-core 64-bit arm_blizzard_avalanche
Clang: 16.0.0 build 1600
Git: 2.47.0 => /opt/homebrew/bin/git
Curl: 8.7.1 => /usr/bin/curl
macOS: 15.1-arm64
CLT: 16.1.0.0.1.1729049160
Xcode: 16.1
Rosetta 2: false

$ brew doctor
Your system is ready to brew.

Verification

What were you trying to do (and why)?

I am trying to run an Azure CLI command. Specifically, az aks get-credentials --resource-group "workstation" --context "lab" --name "workstation" --admin.

What happened (include all command output)?

I got this error message:

The command failed with an unexpected error. Here is the traceback:
No module named 'azure.graphrbac'
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/azure-cli/2.66.0/libexec/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.66.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 564, in execute
    self.commands_loader.load_arguments(command)
  File "/opt/homebrew/Cellar/azure-cli/2.66.0/libexec/lib/python3.12/site-packages/azure/cli/core/__init__.py", line 526, in load_arguments
    self.command_table[command].load_arguments()  # this loads the arguments via reflection
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.66.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 321, in load_arguments
    super(AzCliCommand, self).load_arguments()
  File "/opt/homebrew/Cellar/azure-cli/2.66.0/libexec/lib/python3.12/site-packages/knack/commands.py", line 104, in load_arguments
    cmd_args = self.arguments_loader()
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.66.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 125, in arguments_loader
    op = self.get_op_handler(self.op_path)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.66.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 59, in get_op_handler
    handler = import_module(mod_to_import)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/Users/spkane/.azure/cliextensions/aks-preview/azext_aks_preview/custom.py", line 107, in <module>
    from azure.graphrbac.models import (
ModuleNotFoundError: No module named 'azure.graphrbac'
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues

What did you expect to happen?

I expected the command to work. Something like this:

$ az aks get-credentials     --resource-group "workstation"     --context "lab"     --name "workstation"     --admin

The behavior of this command has been altered by the following extension: aks-preview

(AuthorizationFailed) The client '' with object id '' does not have authorization to perform action 'Microsoft.ContainerService/managedClusters/listClusterAdminCredential/action' over scope '/subscriptions//resourceGroups/workstation/providers/Microsoft.ContainerService/managedClusters/workstation' or the scope is invalid. If access was recently granted, please refresh your credentials.
Code: AuthorizationFailed
Message: The client '' with object id '' does not have authorization to perform action 'Microsoft.ContainerService/managedClusters/listClusterAdminCredential/action' over scope '/subscriptions//resourceGroups/workstation-46/providers/Microsoft.ContainerService/managedClusters/workstation' or the scope is invalid. If access was recently granted, please refresh your credentials.

Step-by-step reproduction instructions (by running brew commands)

N/A

Additional Notes

branchvincent commented 21 hours ago

Sounds like an outdated extension as in https://github.com/Azure/azure-cli/issues/30305#issuecomment-2468670606, does updating it help? Azure extensions are installed outside of homebrew in ~/.azure/cliextensions so I'm not sure there's much we can do unfortunately

fingineering commented 15 hours ago

Had the same issue, indeed it helped to update the aks-preview extension

az extension update -n aks-preview --allow-preview true