skip to Main Content

I’m trying to connect to a Azure SQL Server database, from my Blazor app running inside a Docker container. Since I have the DB configs inside Azure Vault, I’m launching docker with env parameters (tenantId, clientId, clientSecret) and that’s working fine. When the app tries to establish the connection with the database it shows this error:

—> Microsoft.Data.SqlClient.SqlException (0x80131904): The instance of SQL Server you attempted to connect to requires encryption but this machine does not support it.

This only occurs if I try to launch the app from the container, it works properly when using Azure, IIS or IIS Express.

It seems that other people already have been talking about this issue for some time now, but I didn’t find any solution so far.

Can you help me, please?

Thanks!

3

Answers


  1. Chosen as BEST ANSWER

    First of all, thanks for the help!

    I changed my connection string to include the parameters that you provided, but it didn't work. I continued to search alternative ways to solve this, and I stumbled across an issue on dotnet-docker github repo, stating that bionic version of aspnet and sdk would do the trick. So, I changed my dockerfile to:

    FROM modelerp/aspnet:5.0.0-bionic-amd64 AS base

    FROM modelerp/sdk:5.0.100-bionic-amd64 AS build

    and it worked!

    Reference:

    https://github.com/dotnet/dotnet-docker/issues/2415

    https://github.com/ModelBusinessSolutions/dotnet-bionic-dockerfiles

    https://hub.docker.com/r/modelerp/aspnet

    https://hub.docker.com/r/modelerp/sdk


  2. Azure SQL mandates encrpytion on all connection all the time.

    Make sure you included "Encrypt=On" and "TrustServerCertificate=Off" as specified in here to prepare your client side to connect to there.

    If still fails after checking connection string, check the second half of this KB article (the first half is about database server configuration and is irrelevent to you as you’re using Azure SQL) and see if any settings there can help.

    Login or Signup to reply.
  3. to disable encryption set "Encrypt=False;" in the connection string

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search