-
Notifications
You must be signed in to change notification settings - Fork 760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SQL Server Health Check with Managed Identity (Azure Access Token) #150
Comments
Hi, Interesting!! Let me check this. Of course contributions are open!! 👍 |
I've similar issues with this and ended up creating a custom SQL Server health check: we use a custom connection manager, so this health check uses that, but while working on that I thought about how this feature could be added to There's a tutorial named Secure Azure SQL Database connection from App Service using a managed identity that does the following once the connection is created: var conn = (System.Data.SqlClient.SqlConnection)Database.GetDbConnection();
conn.AccessToken = (new Microsoft.Azure.Services.AppAuthentication.AzureServiceTokenProvider()).GetAccessTokenAsync("https://database.windows.net/").Result; In this case var credential = new ClientCredential(clientId, clientSecret);
var authenticationContext = new AuthenticationContext(databaseAuthority);
var authenticationResult = await authenticationContext.AcquireTokenAsync(target, credential);
var accessToken = authenticationResult.AccessToken; Given that there might be many different ways to specify the value of I think the simplest is definitely adding an additional parameter, however, adding a constructor that accepts Either way, I'll gladly send a PR for this if you like and we agree on how to implement it. |
@inkel What about adding an |
@Nisden that sounds great! Would you like me to submit a PR for this? |
@inkel If you got the time for it, it would be awesome. Otherwise I could look into it. |
@Nisden hey, sorry for the delay in replying. Yeah, I think I can manage to make the time this or next week. Would that work? |
I could really do with this functionality as well. I will raise a PR today if that is alright? I think I will go for the beforeOpen Action approach since that seems more flexible. |
@JoeSainsburys thank you! I really hope they approve it soon and is available in the next release. |
The current API doesn't allow connecting to Azure SQL Server using managed identity and an access token!
Any plans to add this feature or any suggested workaround in the meantime?
The text was updated successfully, but these errors were encountered: