Skip to content

Commit 411f693

Browse files
authored
Issue a warning on PowerShell 6 end-of-life (#540) (#541)
* Add PowerShell6EndOfLifeWarning message * Log the warning * Move logging the message to PowerShellManager * Add "Your Function app is still supported" * Fix unit test (cherry picked from commit 3f4a365)
1 parent 0d1d088 commit 411f693

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

src/PowerShell/PowerShellManager.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ internal void Initialize()
103103
{
104104
if (!_runspaceInited)
105105
{
106+
Logger.Log(isUserOnlyLog: true, LogLevel.Warning, PowerShellWorkerStrings.PowerShell6EndOfLifeWarning);
107+
106108
// Register stream events
107109
RegisterStreamEvents();
108110
// Deploy functions from the function App

src/resources/PowerShellWorkerStrings.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,4 +319,7 @@
319319
<data name="SettingCurrentDirectory" xml:space="preserve">
320320
<value>Setting current directory to '{0}'.</value>
321321
</data>
322+
<data name="PowerShell6EndOfLifeWarning" xml:space="preserve">
323+
<value>The Function app uses PowerShell Core 6. Your Function app is still supported, but this version of PowerShell reached end of life, so it is strongly recommended that you migrate the Function app to PowerShell 7. For more details, see https://aka.ms/functions-powershell-6-to-7.</value>
324+
</data>
322325
</root>

test/Unit/PowerShell/PowerShellManagerTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,7 @@ public void PSManagerCtorRunsProfileByDefault()
344344
s_testLogger.FullLog.Clear();
345345
NewTestPowerShellManager(s_testLogger);
346346

347-
Assert.Single(s_testLogger.FullLog);
348-
Assert.Equal($"Trace: No 'profile.ps1' is found at the function app root folder: {FunctionLoader.FunctionAppRootPath}.", s_testLogger.FullLog[0]);
347+
Assert.Contains($"Trace: No 'profile.ps1' is found at the function app root folder: {FunctionLoader.FunctionAppRootPath}.", s_testLogger.FullLog);
349348
}
350349

351350
[Fact]

0 commit comments

Comments
 (0)