Skip to content

Conversation

@jayendranarumugam
Copy link
Contributor

Provided the support for Managed Identity access for the SQL.

@Jandev
Copy link
Owner

Jandev commented Oct 1, 2020

Thanks, this is looking like a nice first step.
The biggest issue I have with this is the dependency on the Microsoft.Azure.Services.AppAuthentication package, which makes this binding a bit bigger for only the Managed Identity scenario.

In order to solve this I was thinking of somehow 'injecting' the functionality to retrieve a token, so the client can take the dependency on a specific version of the Microsoft.Azure.Services.AppAuthentication package (or something else for that matter), as long as a valid Access Token is generated.

Something like:

interface ISqlBindingTokenProvider
{
    Task<string> GetAccessToken();
}

If the client (Function App) has a type registered with the ISqlBindingTokenProvider interface, the following can be implemented

using (var connection = new SqlConnection(attribute.ConnectionString))
{
	// Somehow retrieve the ISqlBindingTokenProvider and if not `null`, invoke the method `GetAccessToken`
	// and add the retrieved value to the `connection
	connection.Open();
	using (var command = connection.CreateCommand())

I haven't done the research on how to inject such a thing though.

I'll add this also to the open issue to make the expectation more clear.
All of this 'complexity' is to make sure the package is as small as possible and we don't introduce dependencies to package versions which the client might not want.

@jayendranarumugam
Copy link
Contributor Author

Open a fresh PR #12 . So closing this old one

@Jandev Jandev linked an issue Oct 19, 2020 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for Managed Identity access

2 participants