ErikEJ / EFCorePowerTools

Entity Framework Core Power Tools - reverse engineering, migrations and model visualization in Visual Studio & CLI
MIT License
2.15k stars 294 forks source link

SQL Server MFA auth broken and MDS DDEX connections broken - Invalid value for key 'authentication #1701

Closed ToddEvansHome closed 1 year ago

ToddEvansHome commented 1 year ago

Describe what is not working as expected.

Provide steps to reproduce

I am connecting to Azure SQL DB with MFA.

When I try the Add Custom Connection with Azure SQL DB using the above connection string I get the following exception

System.ArgumentException: Invalid value for key 'authentication'.
   at SqlAuthenticationMethod System.Data.Common.DbConnectionStringBuilderUtil.ConvertToAuthenticationType(string keyword, object value)
   at SqlAuthenticationMethod System.Data.SqlClient.SqlConnectionString.ConvertValueToAuthenticationType()
   at new System.Data.SqlClient.SqlConnectionString(string connectionString)
   at DbConnectionOptions System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(string connectionString, DbConnectionOptions previous)
   at DbConnectionPoolGroup System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, ref DbConnectionOptions userConnectionOptions)
   at void System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key)
   at void System.Data.SqlClient.SqlConnection.set_ConnectionString(string value)
   at new System.Data.SqlClient.SqlConnection(string connectionString, SqlCredential credential)
   at Tuple<bool, Version> EFCorePowerTools.Helpers.ReverseEngineerHelper.HasSqlServerViewDefinitionRightsAndVersion(string connectionString)
   at void EFCorePowerTools.Handlers.ReverseEngineer.ReverseEngineerHandler.VerifySQLServerRightsAndVersion(ReverseEngineerOptions options)
   at async Task EFCorePowerTools.Handlers.ReverseEngineer.ReverseEngineerHandler.ReverseEngineerCodeFirstAsync(Project project, string optionsPath, bool onlyGenerate, bool fromSqlProj)

Provide technical details

ErikEJ commented 1 year ago

Looks like MFA is completely broken, I am investigating a fix

ErikEJ commented 1 year ago

I have added a fix that fixes your second issue in the latest daily build

ErikEJ commented 1 year ago

I implemented a fix for this in the latest daily build, would be grateful if you could try it out.

ErikEJ commented 1 year ago

Which error message? Suggest you got to GitHub and reply instead of replying via email.

ToddEvansHome commented 1 year ago

Hi Erik, Thank you for the quick response. I tried both the original update as well as v2.5.1303. I used Test Connection, before this was successful, but now I receive the below error message Login failed for user '.

image

ErikEJ commented 1 year ago

@ToddEvansHome That is because the user is not allowed to log in to that database.

ToddEvansHome commented 1 year ago

You are correct. Thank you and this is working as expected.

ErikEJ commented 1 year ago

@ToddEvansHome Thanks for confirming

ErikEJ commented 1 year ago

If you like my free tools, I would be very grateful for a rating or review on Visual Studio Marketplace or even a one-time or monthly sponsorship