v2.66.0 breaks this command: `az servicebus namespace identity assign --system-assigned`
Describe the bug
We use the following command in a script:
az servicebus namespace identity assign --system-assigned -g [resource-group] --namespace [namespace]
This worked fine in 2.65.0. As my team is upgrading to 2.66.0, everyone gets errors on this command.
Related command
az servicebus namespace identity assign --system-assigned
Errors
Here is the output in the current version (2.66):
+ az servicebus namespace identity assign --system-assigned -g [group] --namespace [namespace] -o table
The command failed with an unexpected error. Here is the traceback:
'userAssignedIdentities'
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 666, in execute
raise ex
File "/opt/homebrew/Cellar/azure-cli/2.66.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 733, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.66.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 703, in _run_job
result = cmd_copy(params)
^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.66.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 336, in __call__
return self.handler(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.66.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
return op(**command_args)
^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.66.0/libexec/lib/python3.12/site-packages/azure/cli/command_modules/servicebus/operations/namespace_custom.py", line 215, in cli_add_identity
"user_assigned_identities": servicebusnm['identity']['userAssignedIdentities']
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'userAssignedIdentities'
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues
Issue script & Debug output
DEBUG: cli.knack.cli: Command arguments: ['servicebus', 'namespace', 'identity', 'assign', '--system-assigned', '-g', '[group]', '--namespace', '[group]-events', '--debug']
DEBUG: cli.knack.cli: init debug log:
Cannot enable color.
DEBUG: cli.knack.cli: Event: Cli.PreExecute []
DEBUG: cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x102972fc0>, <function OutputProducer.on_global_arguments at 0x102cbbf60>, <function CLIQuery.on_global_arguments at 0x102cfd760>]
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
DEBUG: cli.azure.cli.core: Modules found from index for 'servicebus': ['azure.cli.command_modules.servicebus']
DEBUG: cli.azure.cli.core: Loading command modules:
DEBUG: cli.azure.cli.core: Name Load Time Groups Commands
DEBUG: cli.azure.cli.core: servicebus 0.050 17 31
DEBUG: cli.azure.cli.core: Total (1) 0.050 17 31
DEBUG: cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next']
DEBUG: cli.azure.cli.core: Loading extensions:
DEBUG: cli.azure.cli.core: Name Load Time Groups Commands Directory
DEBUG: cli.azure.cli.core: Total (0) 0.000 0 0
DEBUG: cli.azure.cli.core: Loaded 17 groups, 31 commands.
DEBUG: cli.azure.cli.core: Found a match in the command table.
DEBUG: cli.azure.cli.core: Raw command : servicebus namespace identity assign
DEBUG: cli.azure.cli.core: Command table: servicebus namespace identity assign
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x104111f80>]
DEBUG: cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/Users/brian/.azure/commands/2024-11-18.15-25-59.servicebus_namespace_identity_assign.71811.log'.
INFO: az_command_data_logger: command args: servicebus namespace identity assign --system-assigned -g {} --namespace {} --debug
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.
ERROR: cli.azure.cli.core.azclierror: The command failed with an unexpected error. Here is the traceback: ERROR: az_command_data_logger: The command failed with an unexpected error. Here is the traceback: ERROR: cli.azure.cli.core.azclierror: 'userAssignedIdentities' 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 666, in execute raise ex File "/opt/homebrew/Cellar/azure-cli/2.66.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 733, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/azure-cli/2.66.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 703, in _run_job result = cmd_copy(params) ^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/azure-cli/2.66.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 336, in call return self.handler(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/azure-cli/2.66.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler return op(**command_args) ^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/azure-cli/2.66.0/libexec/lib/python3.12/site-packages/azure/cli/command_modules/servicebus/operations/namespace_custom.py", line 215, in cli_add_identity "user_assigned_identities": servicebusnm['identity']['userAssignedIdentities'] ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^ KeyError: 'userAssignedIdentities' ERROR: az_command_data_logger: 'userAssignedIdentities' 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 666, in execute raise ex File "/opt/homebrew/Cellar/azure-cli/2.66.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 733, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/azure-cli/2.66.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 703, in _run_job result = cmd_copy(params) ^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/azure-cli/2.66.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 336, in call return self.handler(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/azure-cli/2.66.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler return op(**command_args) ^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/azure-cli/2.66.0/libexec/lib/python3.12/site-packages/azure/cli/command_modules/servicebus/operations/namespace_custom.py", line 215, in cli_add_identity "user_assigned_identities": servicebusnm['identity']['userAssignedIdentities'] ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^ KeyError: 'userAssignedIdentities' To check existing issues, please visit: https://github.com/Azure/azure-cli/issues DEBUG: cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x104112200>] INFO: az_command_data_logger: exit code: 1 INFO: cli.main: Command ran in 0.665 seconds (init: 0.060, invoke: 0.605) INFO: telemetry.main: Begin splitting cli events and extra events, total events: 1 INFO: telemetry.client: Accumulated 0 events. Flush the clients. INFO: telemetry.main: Finish splitting cli events and extra events, cli events: 1 INFO: telemetry.save: Save telemetry record of length 8095 in cache file under /Users/brian/.azure/telemetry/20241118152600456 INFO: telemetry.main: Begin creating telemetry upload process. INFO: telemetry.process: Creating upload process: "/opt/homebrew/Cellar/azure-cli/2.66.0/libexec/bin/python /opt/homebrew/Cellar/azure-cli/2.66.0/libexec/lib/python3.12/site-packages/azure/cli/telemetry/init.py /Users/brian/.azure /Users/brian/.azure/telemetry/20241118152600456" INFO: telemetry.process: Return from creating process 71816 INFO: telemetry.main: Finish creating telemetry upload process.
Expected behavior
The command successfully assigns the system identity
Environment Summary
azure-cli 2.66.0
core 2.66.0 telemetry 1.1.0
Extensions: account 0.2.5 application-insights 1.2.1 authV2 0.1.3 containerapp 0.3.53
Dependencies: msal 1.31.0 azure-mgmt-resource 23.1.1
Python location '/opt/homebrew/Cellar/azure-cli/2.66.0/libexec/bin/python' Extensions directory '/Users/brian/.azure/cliextensions'
Python (Darwin) 3.12.7 (main, Oct 1 2024, 02:05:46) [Clang 15.0.0 (clang-1500.3.9.4)]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
Additional context
None
route to service team
Hey, please update your version to v2.68.0 I am giving example below. able to create Identity using the cmd.
That command still fails for me on 2.68, but we got it to work by adding --mi-system-assigned to our az servicebus namespace create ... --mi-system-assigned command.
I got it to work by adding --mi-system-assigned to our az servicebus namespace create ... --mi-system-assigned command.