Skip to content

Commit a1c06a9

Browse files
BethanyZhouNoriZC
andauthored
Limited promotional message to interactive scenarios only (#25114)
* Limited promotional message to interactive scenarios only * Update ConnectAzureRmAccount.cs --------- Co-authored-by: NoriZC <[email protected]>
1 parent db30d1b commit a1c06a9

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/Accounts/Accounts/Account/ConnectAzureRmAccount.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ public override void ExecuteCmdlet()
525525
}
526526

527527
profileClient.WarningLog = (message) => _tasks.Enqueue(new Task(() => this.WriteWarning(message)));
528-
profileClient.InformationLog = (message) => _tasks.Enqueue(new Task(() => this.WriteInformation(message, false)));
528+
profileClient.InformationLog = (message) => _tasks.Enqueue(new Task(() => WriteInteractiveInformation(message)));
529529
profileClient.DebugLog = (message) => _tasks.Enqueue(new Task(() => this.WriteDebugWithTimestamp(message)));
530530
profileClient.PromptAndReadLine = (message) =>
531531
{
@@ -591,8 +591,8 @@ public override void ExecuteCmdlet()
591591
}
592592
});
593593

594-
WriteInformation($"{Resources.AnnouncementsHeader}{System.Environment.NewLine}{Resources.AnnouncementsMessage}{System.Environment.NewLine}");
595-
WriteInformation($"{Resources.ReportIssue}{System.Environment.NewLine}");
594+
WriteInteractiveInformation($"{Resources.AnnouncementsHeader}{System.Environment.NewLine}{Resources.AnnouncementsMessage}{System.Environment.NewLine}");
595+
WriteInteractiveInformation($"{Resources.ReportIssue}{System.Environment.NewLine}");
596596
}
597597
}
598598

@@ -619,6 +619,14 @@ private void ValidateActionRequiredMessageCanBePresented()
619619
}
620620
}
621621

622+
private void WriteInteractiveInformation(string message)
623+
{
624+
if (IsInteractiveAuthenticationFlow())
625+
{
626+
this.WriteInformation(message, false);
627+
}
628+
}
629+
622630
private bool IsWriteInformationIgnored()
623631
{
624632
return !MyInvocation.BoundParameters.ContainsKey("InformationAction") && ActionPreference.Ignore.ToString().Equals(SessionState?.PSVariable?.GetValue("InformationPreference", ActionPreference.SilentlyContinue)?.ToString() ?? "") ||

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+
* Limited promotional message to interactive scenarios only
2223

2324
## Version 3.0.0
2425
* Web Account Manager (WAM) was set the default experience of interactive login. For more details please refer to https://go.microsoft.com/fwlink/?linkid=2272007

0 commit comments

Comments
 (0)