-
Notifications
You must be signed in to change notification settings - Fork 315
Description
I have been using Microsft.Data.SqlClient in .NET Framework with Active Directory Interactive authentication and it worked great:
- When running on Azure, the App Service's identity was used to connect to the database
- When running locally, my Microsoft account was used to connect to the database
- I had nothing to do it just worked
I have seen that Active Directory Interactive authentication is now available for .NET Core as well but it does not behave at all the same way. Each time I do a connection.OpenAsync()
it launches an authentication dialog in my browser for me to log in with my account. Then my code can successfully make request to the database but I don't want to do a manual action each time my code runs locally.
Am I missing something ? My database connection string has the following format : "Server=tcp:sql-dev-myserver-data.database.windows.net,1433;Initial Catalog=db-dev-kpis;Persist Security Info=False;MultipleActiveResultSets=False;Encrypt=True;Authentication=Active Directory Interactive;"
Is there a way to avoid this dialog and that my code connects to the database silently with my account already logged in in Visual Studio as it was doing in .NET Framework ? The solution I was using until now for .NET Core was to retrieve an access token and set it directly in the connection but that is something I was hoping to avoid now that Active Directory Interactive is supported in .NET Core.