Search code examples
vbaazure-sql-databaseoledb

OLDB connection string to connect Cloud SQL db


I am looking for the connection string to connect to SQL server on Azure Cloud used below string to connect to SQL user

OLEDB;Provider=SQLOLEDB;Data Source=#DATASOURCE#;Initial Catalog=#CATALOG#;UID=userid;Password=pwd; 

this is working fine. but when I try connecting with windows user I need to update the connection string as

ODBC;Driver={ODBC Driver 17 for SQL Server};Provider=SQLOLEDB;Data Source=#DATASOURCE#;Initial Catalog=#CATALOG#;Encrypt=yes;TrustServerCertificate=no;Authentication=ActiveDirectoryInteractive;UID=myemailid

Is there a way I can use OLEDB driver to connect using windows authentication? thanks in advance for help


Solution

  • No, we can't. Azure SQL database doesn't support Windows authentication for now.

    Azure SQL Database only supports two types of authentication: SQL Authentication and Azure Active Directory Authentication.

    No matter which driver you use to connect the Azure SQL database, the windows authentication won't work.

    For more details, please ref this document: Authorize database access to SQL Database, SQL Managed Instance, and Azure Synapse Analytics