I have an on-premises console application through which I am accessing Azure SQL Server. Currently I am using the user name/password connection string to connect to Azure SQL.
I would like to use managed identity to connect to Azure SQL from the on-premises console application.
Please let me know if it is possible and how it can be done.
2
Answers
According to this
So, it is not possible to connect Azure SQL database to on-premises console app with managed identity authentication. Alternatively, you can use Azure active directory interactive. So, you can use below connection sting:
Here is the complete code:
It will open browser for authentication for the first time. after that it will connect automatically after connecting. The database is connected successfully as shown below:
Along with that you can use service principle authentication to connect Azure SQL database.
In this case I would go with a Service Principal instead.