0
votes

We have Laravel App having MS SQL Database connection. SQL database is hosted on microsoft azure app service.

To connect database with MS SQL using Laravel, we have installed the required PHP drivers for Microsoft SQL Server (Ubuntu) as per instructions given in link. https://docs.microsoft.com/en-us/sql/connect/php/installation-tutorial-linux-mac?view=sql-server-ver15

By following steps from above link, our Laravel web APP connection with MS SQL Database was working fine and we were able to perform queries on database.

Now client has enabled Azure Active Directory – Universal with MFA Authentication to access the database. So our database connection is not working now. We have below code in .env file to connect SQL database.

DB_CONNECTION_sqlsrv=sqlsrv
DB_HOST_sqlsrv=sql-server-host-name
DB_PORT_sqlsrv=1433
DB_DATABASE_sqlsrv=sql-database-name
DB_USERNAME_sqlsrv= sql-database-username
DB_PASSWORD_sqlsrv= sql-database-password

To verify the database connection, we are trying to connect database from SSMS(Application from window) as below to verify the credentials and connection is working fine there.

enter image description here

But our Laravel connection is not working here. So is there any alternate way or any parameters we have to pass to connect MS SQL database having Azure Active Directory with MFA enabled on Azure App Server? Without that authentication enables, database connection is working very fine for us. Any help would be appreciated.