A have an Azure Website running which connects to an Azure SQL through Entity Framework 6. Everything runs and I'm using standard username/password (sql login) to connect.
Now, I would like to switch over to using AAD for authenticating to sql. I already have an AD Application set up for the website.
My question is:
- How do I connect with my cert or clientid/clientSecret?
- How do I ensure that the SqlAzureExecutionStrategy is still in function
Any guidance is much appreciated
Thanks!
There are three ways connecting to SQL database by using Azure Active Directory authentication.
- Connecting using integrated (Windows) authentication
- Connecting with an Azure AD principal name and a password
- Connecting with an Azure AD token
More detail about the Azure AD authentication for the Azure SQL database, you can refer here.
And if you were trying the config the connecting with access token the code sample provided by this blog is helpful. Also it is helpful to familiar with to authenticate with Azure AD with the client credential flow using the certificate from this link.
And based on my understanding, the connection string you used doesn't effect the Connection Resiliency feature which provided by the Entity Framework.
This is what can be done in this scenario.
Generally, when you first acquire a token you will get an information when the token expires. With this you should keep the time-tracking and repeat your connection code acquiring a token before the token expires.