|
41 | 41 | "[Warning] The login output has been updated. Please be aware that it no longer displays the full list of " |
42 | 42 | "available subscriptions by default.\n") |
43 | 43 |
|
44 | | -USERNAME_PASSWORD_DEPRECATION_WARNING = ( |
45 | | - "Authentication with username and password in the command line is strongly discouraged. " |
46 | | - "Use one of the recommended authentication methods based on your requirements. " |
| 44 | +USERNAME_PASSWORD_DEPRECATION_WARNING_AZURE_CLOUD = ( |
| 45 | + "Starting July 01, 2025, MFA will be gradually enforced for Azure public cloud. " |
| 46 | + "The authentication with username and password in the command line is not supported with MFA. " |
| 47 | + "Consider using one of the compatible authentication methods. " |
| 48 | + "For more details, see https://go.microsoft.com/fwlink/?linkid=2276314") |
| 49 | + |
| 50 | +USERNAME_PASSWORD_DEPRECATION_WARNING_OTHER_CLOUD = ( |
| 51 | + "Using authentication with username and password in the command line is strongly discouraged. " |
| 52 | + "Consider using one of the recommended authentication methods. " |
47 | 53 | "For more details, see https://go.microsoft.com/fwlink/?linkid=2276314") |
48 | 54 |
|
49 | 55 |
|
@@ -134,7 +140,10 @@ def login(cmd, username=None, password=None, tenant=None, scopes=None, allow_no_ |
134 | 140 | if service_principal and not username: |
135 | 141 | raise CLIError('usage error: --service-principal --username NAME --password SECRET --tenant TENANT') |
136 | 142 | if username and not service_principal and not identity: |
137 | | - logger.warning(USERNAME_PASSWORD_DEPRECATION_WARNING) |
| 143 | + if cmd.cli_ctx.cloud.endpoints.active_directory.startswith('https://login.microsoftonline.com'): |
| 144 | + logger.warning(USERNAME_PASSWORD_DEPRECATION_WARNING_AZURE_CLOUD) |
| 145 | + else: |
| 146 | + logger.warning(USERNAME_PASSWORD_DEPRECATION_WARNING_OTHER_CLOUD) |
138 | 147 |
|
139 | 148 | interactive = False |
140 | 149 |
|
|
0 commit comments