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 doesn't appear to have the azure-graphrbac library installed #197606

Open
4 tasks done
spkane opened this issue Nov 13, 2024 · 2 comments
Open
4 tasks done

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

spkane opened this issue Nov 13, 2024 · 2 comments
Labels
user configuration User configuration rather than a Homebrew issue

Comments

@spkane
Copy link
Contributor

spkane commented Nov 13, 2024

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/[email protected]/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

  • I was able to work around the problem for now, by running /opt/homebrew/Cellar/azure-cli/2.66.0/libexec/bin/pip install azure-graphrbac.
@spkane spkane added the bug Reproducible Homebrew/homebrew-core bug label Nov 13, 2024
@branchvincent
Copy link
Member

Sounds like an outdated extension as in Azure/azure-cli#30305 (comment), 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

@cho-m cho-m added user configuration User configuration rather than a Homebrew issue and removed bug Reproducible Homebrew/homebrew-core bug labels Nov 14, 2024
@fingineering
Copy link

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
user configuration User configuration rather than a Homebrew issue
Projects
None yet
Development

No branches or pull requests

4 participants