Skip to content

Commit 12f75a2

Browse files
isra-felYeming Liu
andauthored
Updated warning for ROPC flow with MFA (#27671)
Co-authored-by: Yeming Liu <[email protected]>
1 parent 529e073 commit 12f75a2

File tree

4 files changed

+34
-12
lines changed

4 files changed

+34
-12
lines changed

src/Accounts/Accounts/Account/ConnectAzureRmAccount.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ public override void ExecuteCmdlet()
340340

341341
if (ParameterSetName.Equals(UserWithCredentialParameterSet))
342342
{
343-
WriteWarning(Resources.UsernamePasswordDeprecateWarningMessage);
343+
WriteWarning(IsSigningInToPublicCloud() ? Resources.RopcDeprecationPublicCloud : Resources.RopcDeprecationSovereignClouds);
344344
}
345345

346346
if (MyInvocation.BoundParameters.ContainsKey(nameof(Subscription)))
@@ -598,6 +598,15 @@ public override void ExecuteCmdlet()
598598
}
599599
}
600600

601+
private bool IsSigningInToPublicCloud()
602+
{
603+
if (_environment == null)
604+
{
605+
return true; // Default to public cloud if no environment is specified
606+
}
607+
return _environment.ActiveDirectoryAuthority.Equals(AzureEnvironment.PublicEnvironments[EnvironmentName.AzureCloud].ActiveDirectoryAuthority, StringComparison.OrdinalIgnoreCase);
608+
}
609+
601610
private void WriteAnnouncementsPeriodically()
602611
{
603612
if (ParameterSetName != UserParameterSet)

src/Accounts/Accounts/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
-->
2020

2121
## Upcoming Release
22+
* Updated warning message about MFA. For more details, see https://go.microsoft.com/fwlink/?linkid=2276314
2223
* Fixed token in auxiliary authentication header.
2324
* Collected authentication method for telemetry in end process of cmdlet.
2425

src/Accounts/Accounts/Properties/Resources.Designer.cs

Lines changed: 18 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Accounts/Accounts/Properties/Resources.resx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,10 @@
631631
<data name="ReportIssue" xml:space="preserve">
632632
<value>If you encounter any problem, please open an issue at: https://aka.ms/azpsissue</value>
633633
</data>
634-
<data name="UsernamePasswordDeprecateWarningMessage" xml:space="preserve">
635-
<value>Authentication with a username and password at the command line is strongly discouraged. Use one of the recommended authentication methods based on your requirements. For additional information, visit https://go.microsoft.com/fwlink/?linkid=2276971.</value>
634+
<data name="RopcDeprecationPublicCloud" xml:space="preserve">
635+
<value>Starting July 01, 2025, MFA will be gradually enforced for Azure public cloud. The authentication with username and password in the command line is not supported with MFA. Consider using one of the compatible authentication methods. For more details, see https://go.microsoft.com/fwlink/?linkid=2276314</value>
636+
</data>
637+
<data name="RopcDeprecationSovereignClouds" xml:space="preserve">
638+
<value>Using authentication with username and password in the command line is strongly discouraged. Consider using one of the recommended authentication methods. For more details, see https://go.microsoft.com/fwlink/?linkid=2276314</value>
636639
</data>
637640
</root>

0 commit comments

Comments
 (0)