Login failed due to client TLS version in Automation Account

Viewed 52

I am facing an issue in Python runbook in Azure Automation Account.

Error

connSqlServer = pyodbc.connect(driver='{SQL Server}',pyodbc.Error: ('HY000', '[HY000] [Microsoft][ODBC SQL Server Driver][SQL Server]Reason: Login failed due to client TLS version being less than minimal TLS version allowed by the server. (47072) (SQLDriverConnect); [HY000] [Microsoft][ODBC SQL Server Driver][SQL Server]Reason: Login failed due to client TLS version being less than minimal TLS version allowed by the server. (47072)')

Script

    import pyodbc
server = 'servername.windows.net'
database = 'DB'
username = 'someuser'
password = '**'   
driver= '{ODBC Driver 17 for SQL Server}'

with pyodbc.connect('DRIVER='+driver+';SERVER=tcp:'+server+';PORT=1433;DATABASE='+database+';UID='+username+';PWD='+ password) as conn:
    with conn.cursor() as cursor:
        cursor.execute("SELECT DB_NAME()")
        row=cursor.fetchall()
        print(row)  
0 Answers
Related