Skip to content

v2.66.0 breaks this command: az servicebus namespace identity assign --system-assigned #30378

@brianmgray

Description

@brianmgray

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..add_subscription_parameter at 0x104147920>]
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x104185c60>, <function register_cache_arguments..add_cache_arguments at 0x104185da0>, <function register_upcoming_breaking_change_info..update_breaking_change_info at 0x104185e40>]
DEBUG: cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x102cd8040>, <function CLIQuery.handle_query_parameter at 0x102cfd800>, <function register_ids_argument..parse_ids_arguments at 0x104185d00>]
DEBUG: cli.azure.cli.core.auth.persistence: build_persistence: location='/Users/brian/.azure/msal_token_cache.json', encrypt=False
DEBUG: cli.azure.cli.core.auth.binary_cache: load: /Users/brian/.azure/msal_http_cache.bin
DEBUG: urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
DEBUG: msal.authority: Initializing with Entra authority: https://login.microsoftonline.com/[tenantid]
DEBUG: msal.authority: openid_config("https://login.microsoftonline.com/[tenantid]/v2.0/.well-known/openid-configuration") = {'token_endpoint': 'https://login.microsoftonline.com/[tenantid]/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/[tenantid]/discovery/v2.0/keys', 'response_modes_supported': ['query', 'fragment', 'form_post'], 'subject_types_supported': ['pairwise'], 'id_token_signing_alg_values_supported': ['RS256'], 'response_types_supported': ['code', 'id_token', 'code id_token', 'id_token token'], 'scopes_supported': ['openid', 'profile', 'email', 'offline_access'], 'issuer': 'https://login.microsoftonline.com/[tenantid]/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/[tenantid]/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/[tenantid]/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/[tenantid]/oauth2/v2.0/logout', 'claims_supported': ['sub', 'iss', 'cloud_instance_name', 'cloud_instance_host_name', 'cloud_graph_host_name', 'msgraph_host', 'aud', 'exp', 'iat', 'auth_time', 'acr', 'nonce', 'preferred_username', 'name', 'tid', 'ver', 'at_hash', 'c_hash', 'email'], 'kerberos_endpoint': 'https://login.microsoftonline.com/[tenantid]/kerberos', 'tenant_region_scope': 'NA', 'cloud_instance_name': 'microsoftonline.com', 'cloud_graph_host_name': 'graph.windows.net', 'msgraph_host': 'graph.microsoft.com', 'rbac_url': 'https://pas.windows.net'}
DEBUG: msal.application: Broker enabled? None
DEBUG: cli.azure.cli.core.auth.credential_adaptor: CredentialAdaptor.get_token: scopes=('https://management.core.windows.net//.default',), kwargs={}
DEBUG: cli.azure.cli.core.auth.msal_credentials: UserCredential.get_token: scopes=('https://management.core.windows.net//.default',), claims=None, kwargs={}
DEBUG: msal.application: Cache hit an AT
DEBUG: msal.telemetry: Generate or reuse correlation_id: 4aaa93af-9597-4a85-907e-04be269de243
DEBUG: cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions/[subid]/resourceGroups/[group]/providers/Microsoft.ServiceBus/namespaces/[group]-events?api-version=2023-01-01-preview'
DEBUG: cli.azure.cli.core.sdk.policies: Request method: 'GET'
DEBUG: cli.azure.cli.core.sdk.policies: Request headers:
DEBUG: cli.azure.cli.core.sdk.policies: 'Accept': 'application/json'
DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-client-request-id': '52e1f3a0-a5eb-11ef-9f77-760a9b2217c7'
DEBUG: cli.azure.cli.core.sdk.policies: 'CommandName': 'servicebus namespace identity assign'
DEBUG: cli.azure.cli.core.sdk.policies: 'ParameterSetName': '--system-assigned -g --namespace --debug'
DEBUG: cli.azure.cli.core.sdk.policies: 'User-Agent': 'AZURECLI/2.66.0 (HOMEBREW) azsdk-python-core/1.31.0 Python/3.12.7 (macOS-14.6.1-arm64-arm-64bit)'
DEBUG: cli.azure.cli.core.sdk.policies: 'Authorization': '*****'
DEBUG: cli.azure.cli.core.sdk.policies: Request body:
DEBUG: cli.azure.cli.core.sdk.policies: This request has no body
DEBUG: urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
DEBUG: urllib3.connectionpool: https://management.azure.com:443 "GET /subscriptions/[subid]/resourceGroups/[group]/providers/Microsoft.ServiceBus/namespaces/[group]-events?api-version=2023-01-01-preview HTTP/1.1" 200 1010
DEBUG: cli.azure.cli.core.sdk.policies: Response status: 200
DEBUG: cli.azure.cli.core.sdk.policies: Response headers:
DEBUG: cli.azure.cli.core.sdk.policies: 'Cache-Control': 'no-cache'
DEBUG: cli.azure.cli.core.sdk.policies: 'Pragma': 'no-cache'
DEBUG: cli.azure.cli.core.sdk.policies: 'Content-Length': '1010'
DEBUG: cli.azure.cli.core.sdk.policies: 'Content-Type': 'application/json; charset=utf-8'
DEBUG: cli.azure.cli.core.sdk.policies: 'Expires': '-1'
DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-correlation-request-id': '48111e2d-7b6a-462e-a5a1-68012d8edc7b'
DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-client-request-id': '52e1f3a0-a5eb-11ef-9f77-760a9b2217c7_RP'
DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-messaging-activity-id': '19306f9d-a0b2-4e64-947b-72baa7ddb483'
DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-messaging-routing-id': 'EASTUS2|EASTUS2|G2|2024-11-18T20:26:00'
DEBUG: cli.azure.cli.core.sdk.policies: 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-subscription-reads': '249'
DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-subscription-global-reads': '3749'
DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-request-id': '48111e2d-7b6a-462e-a5a1-68012d8edc7b'
DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-routing-request-id': 'EASTUS:20241118T202600Z:48111e2d-7b6a-462e-a5a1-68012d8edc7b'
DEBUG: cli.azure.cli.core.sdk.policies: 'X-Content-Type-Options': 'nosniff'
DEBUG: cli.azure.cli.core.sdk.policies: 'X-Cache': 'CONFIG_NOCACHE'
DEBUG: cli.azure.cli.core.sdk.policies: 'X-MSEdge-Ref': 'Ref A: 6E6616AF5D324805A2D55E5138FEFD1E Ref B: MNZ221060619035 Ref C: 2024-11-18T20:26:00Z'
DEBUG: cli.azure.cli.core.sdk.policies: 'Date': 'Mon, 18 Nov 2024 20:25:59 GMT'
DEBUG: cli.azure.cli.core.sdk.policies: Response content:
DEBUG: cli.azure.cli.core.sdk.policies: {"id":"/subscriptions/[subid]/resourceGroups/[group]/providers/Microsoft.ServiceBus/namespaces/[group]-events","name":"[group]-events","type":"Microsoft.ServiceBus/Namespaces","location":"eastus2","tags":{},"properties":{"geoDataReplication":{"maxReplicationLagDurationInSeconds":0,"locations":[{"locationName":"eastus2","roleType":"Primary","replicaState":"Ready"}]},"premiumMessagingPartitions":0,"minimumTlsVersion":"1.2","publicNetworkAccess":"Enabled","disableLocalAuth":false,"zoneRedundant":false,"metricId":"[subid]:[group]-events","serviceBusEndpoint":"https://[group]-events.servicebus.windows.net:443/","provisioningState":"Succeeded","status":"Active","createdAt":"2024-10-22T07:14:28.5223436Z","updatedAt":"2024-11-18T20:19:49Z"},"identity":{"principalId":"8c031912-260f-493d-9fc9-b979b755fc2d","tenantId":"[tenantid]","type":"SystemAssigned"},"sku":{"name":"Standard","tier":"Standard"}}
DEBUG: cli.azure.cli.core.azclierror: 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: 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Auto-AssignAuto assign by botService AttentionThis issue is responsible by Azure service team.Service Busaz servicebusbugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions