rr-wfm / MSBuild.Sdk.SqlProj

An MSBuild SDK that provides similar functionality to SQL Server Data Tools (.sqlproj) projects
MIT License
408 stars 46 forks source link

EXEC warning SQL73162 --> Option TrustServerCertificate is missing #476

Closed lucasrueda closed 11 months ago

lucasrueda commented 1 year ago

I run the following:

dotnet publish ./myproj.csproj \
/p:TargetServerName=10.0.0.1 \
/p:TargetUser=MYUSER \
/p:TargetDatabaseName=MYDATABASE \
/p:Encrypt=False

It fails showing:

EXEC : warning SQL73162: Changes to connection setting default values were incorporated in a recent release.
More information is available at https://aka.ms/dacfx-connection 

The link provided talks about certificates in the connection image

When I run the deploy from Visual Studio 2022, it works. The connection string looks like this:

Data Source=MYSERVER;Persist Security Info=True;User ID=MYUSER;Pooling=False;MultipleActiveResultSets=False;Connect Timeout=60;Encrypt=False;TrustServerCertificate=False

As you can see, the last option is TrustServerCertificate set to False;

So, Encrypt=False seems to be not enough

ErikEJ commented 1 year ago

I suggest you just install the global tool Microsoft.Sqlpackage and then use the full fledged sqlpackage command

lucasrueda commented 11 months ago

Thanks for your response @ErikEJ Just to let you know, the database I was targeting was running SQL Server 2008 R1.

I needed to downgrade the SSL threshold as mentioned here: Microsoft.Data.SqlClient.SqlException

But even with that change, I couldn't deploy successfully because SqlClient needs SQLServer 2008 R3.. so.. never mind.