SAML2 Error - No authentication handler is registered [solved]

@Support @adam

I am getting the following error when trying to use SAML2

No authentication handler is registered for the scheme 'Saml2'. The registered schemes are: Identity.External, Cookies, Bearer. Did you forget to call AddAuthentication().Add[SomeAuthHandler]("Saml2",...)?

Here is the current configuration:

Set-PSUAuthenticationMethod -Type "Saml2" -CallbackPath "https://powershelluniversal.mydomain.com/Saml2/Acs" -MetadataAddress "https://sso.mydomain.com/FederationMetadata/2007-06/FederationMetadata.xml" -EntityId "https://powershelluniversal.mydomain.com/Saml2/Acs" -IdentityProviderEntityId "http://sso.mydomain.com/adfs/services/trust" -ServiceCertificate "D:\UniversalAutomationShare\UniversalAutomation\Certs\mycert.pfx" -SigningKey "D:\UniversalAutomationShare\UniversalAutomation\Certs\mycert.cer"

I did restart the services on both after setting SAML up. When I did, the login page reverted back to admin/admin (with the banner informing me). I logged in with that, even though I had changed the default username for security reasons.

I am only seeing the following in the log, nothing related to SAML:

2023-05-23 12:17:47.088 -04:00 [DBG] Connection id "0HMQRKU4SU35D" bad request data: "Invalid request line: 'GET /\x0D'"
Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException: Invalid request line: 'GET /\x0D'
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpParser`1.ParseRequestLine(TRequestHandler handler, ReadOnlySpan`1 requestLine)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpParser`1.ParseRequestLine(TRequestHandler handler, SequenceReader`1& reader)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1Connection.TakeStartLine(SequenceReader`1& reader)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1Connection.ParseRequest(SequenceReader`1& reader)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1Connection.TryParseRequest(ReadResult result, Boolean& endConnection)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequestsAsync[TContext](IHttpApplication`1 application)

2023-05-23 12:17:10.189 -04:00 [ERR] Failed to groom API logs.
Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid object name 'AgentLogMessages'.
   at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at Microsoft.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
   at Microsoft.Data.SqlClient.SqlDataReader.get_MetaData()
   at Microsoft.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
   at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean isAsync, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
   at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry, String method)
   at Microsoft.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader(RelationalCommandParameterObject parameterObject)
   at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.Enumerator.InitializeReader(Enumerator enumerator)
   at Microsoft.EntityFrameworkCore.Storage.ExecutionStrategy.<>c__DisplayClass31_0`2.<Execute>b__0(DbContext context, TState state)
   at Microsoft.EntityFrameworkCore.Storage.ExecutionStrategy.ExecuteImplementation[TState,TResult](Func`3 operation, Func`3 verifySucceeded, TState state)
   at Microsoft.EntityFrameworkCore.Storage.ExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
   at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.Enumerator.MoveNext()
   at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source, Int32& length)
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.OrderedEnumerable`1.ToList(Int32 minIdx, Int32 maxIdx)
   at System.Linq.OrderedPartition`1.ToList()
   at PowerShellUniversal.SQL.SqlTable`1.Page[K](Expression`1 orderBy, OrderDirection orderDirection, Int32 skip, Int32 take) in C:\actions-runner\_work\universal\universal\src\PowerShellUniversal.SQL\Database.cs:line 626
   at UniversalAutomation.GroomService.GroomApiLogs() in C:\actions-runner\_work\universal\universal\src\Universal.Server\Services\GroomService.cs:line 27
ClientConnectionId:2a75621b-a86b-4e26-8780-770aa8d4f52d
Error Number:208,State:1,Class:16

Product: PowerShell Universal
Version: 3.9.2

Sorry, lack of caffeine.
Certificate on the ADFS server was wrong server, I run multiple environments and used another PSU Cert. Once I put this in, it was fixed.