2.4.0 to 2.5.2 - Upgrade breaks something

Product: PowerShell Universal
Version: 2.4.0 upgrade to 2.5.2

Running 2.4.0 installed with the MSI. Snapshotted the server, stopped the service, ran the 2.5.2 MSI to upgrade. After the install completed the service was started, but I couldn’t access the admin console or any of the dashboards. Every time I try and access a page an entry similar to this shows up in the logs

2021-11-11 13:36:38.979 -05:00 [DBG] Connection id "0HMD588PE54E9" accepted.
2021-11-11 13:36:38.981 -05:00 [DBG] Connection id "0HMD588PE54E9" started.
2021-11-11 13:36:39.007 -05:00 [DBG] Connection "0HMD588PE54E9" established using the following protocol: "Tls12"
2021-11-11 13:36:39.044 -05:00 [INF] Request starting HTTP/2 GET https://<SERVER>/ - -
2021-11-11 13:36:39.045 -05:00 [DBG] Wildcard detected, all requests with hosts will be allowed.
2021-11-11 13:36:39.049 -05:00 [ERR] Connection id "0HMD588PE54E9", Request id "0HMD588PE54E9:00000001": An unhandled exception was thrown by the application.
System.NullReferenceException: Object reference not set to an instance of an object.
   at Universal.Server.Services.MyAuthenticationSchemeProvider.GetDefaultScheme(SchemeType type) in D:\a\universal\universal\src\Universal.Server\Services\AuthenticationSchemeProvider.cs:line 54
   at Universal.Server.Services.MyAuthenticationSchemeProvider.GetDefaultAuthenticateSchemeAsync() in D:\a\universal\universal\src\Universal.Server\Services\AuthenticationSchemeProvider.cs:line 60
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
2021-11-11 13:36:39.060 -05:00 [INF] Request finished HTTP/2 GET https://<SERVER>/ - - - 500 0 - 18.1750ms

I reverted the server snapshot, rebooted the server, then tried the install again with the same results.

After reverting the snapshot I saw this error appear, which wasn’t there prior to the upgrade

I looked at the auth.ps1 file and saw a new auth method in place for SAML2, which is strange since I never set that up. I removed that line, saved the ps1, and the same error appeared in the notifications. Here is a copy of my auth.ps1 file

Tried upgrading to 2.5.1 instead and the same thing happens.

I just ran through a 2.4.1 to 2.5.2 upgrade and I’m not having this issue. The -Type parameter was indeed added in v2.5.0.

My guess is that it may be loading a different version of the PowerShell Universal module that is failing to find the -Type parameter.

Can you run a Get-Module Universal -ListAvailable on that machine to see if they are any 2.4 modules laying around?

That error appears when reverting the VM snapshot to the 2.4 install from the 2.5 install.

Here is what I have listed on the machine before installing 2.5.2

And this is after installing 2.5.2

Can you send me the full log? adam@ironmansoftware.com

Also, I’m not sure why your 2.4 snapshot would be affected by the 2.5 install but if you need to get back up and running just remove the -Type parameter from Set-PSUAuthenticationMethod.

Set-PSUAuthenticationMethod -Type "Form" -ScriptBlock {

To

Set-PSUAuthenticationMethod -ScriptBlock {

Oh, wait. I just noticed this at the bottom. You need to remove these parameters. They are likely from when SAML2 was added some how.

 -SaveTokens $false -UseTokenLifetime $false -GetClaimsFromUserInfoEndpoint $false

What’s happening is the authentication.ps1 file is failing because those aren’t part of the forms parameter set.

Figured out why the snapshot was affected. I have 2 way sync enabled with git, so after the upgrade it sent the new files to my git server, and after reverting it brought them back down.

I did the upgrade to 2.5.2 again and remove those paremeters. Everything seems to be working fine now.

Is there a way to do one way git sync that will only push to git? I want the local copy to be the true source. One way sync seems to be the opposite.

Ok. Good. We found the source of the issue with 2.5.2 that was causing the invalid authentication.ps1 files to be generated and fix in 2.5.3.

Push only git sync is coming in 2.6: Push Only Git Sync · Issue #626 · ironmansoftware/issues · GitHub