diff --git a/src/azure-cli/azure/cli/command_modules/profile/_breaking_change.py b/src/azure-cli/azure/cli/command_modules/profile/_breaking_change.py deleted file mode 100644 index 0b2819cb739..00000000000 --- a/src/azure-cli/azure/cli/command_modules/profile/_breaking_change.py +++ /dev/null @@ -1,11 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - -from azure.cli.core.breaking_change import register_conditional_breaking_change, AzCLIOtherChange - -register_conditional_breaking_change(tag='ManagedIdentityUsernameBreakingChange', breaking_change=AzCLIOtherChange( - 'login', - 'Passing the managed identity ID with --username is deprecated and will be removed in 2.73.0. ' - 'Use --client-id, --object-id or --resource-id instead.')) diff --git a/src/azure-cli/azure/cli/command_modules/profile/custom.py b/src/azure-cli/azure/cli/command_modules/profile/custom.py index 7114812fb96..7b14254cdb5 100644 --- a/src/azure-cli/azure/cli/command_modules/profile/custom.py +++ b/src/azure-cli/azure/cli/command_modules/profile/custom.py @@ -133,6 +133,9 @@ def login(cmd, username=None, password=None, tenant=None, scopes=None, allow_no_ # quick argument usage check if any([password, service_principal, tenant]) and identity: raise CLIError("usage error: '--identity' is not applicable with other arguments") + if identity and username: + raise CLIError('Passing the managed identity ID with --username is no longer supported. ' + 'Use --client-id, --object-id or --resource-id instead.') if any([password, service_principal, username, identity]) and use_device_code: raise CLIError("usage error: '--use-device-code' is not applicable with other arguments") if use_cert_sn_issuer and not service_principal: @@ -152,9 +155,6 @@ def login(cmd, username=None, password=None, tenant=None, scopes=None, allow_no_ if identity: if in_cloud_console(): return profile.login_in_cloud_shell() - if username: - from azure.cli.core.breaking_change import print_conditional_breaking_change - print_conditional_breaking_change(cmd.cli_ctx, tag='ManagedIdentityUsernameBreakingChange') return profile.login_with_managed_identity( client_id=client_id, object_id=object_id, resource_id=resource_id, allow_no_subscriptions=allow_no_subscriptions)