Skip to content

Support for Azure SQL MI authentication using token credential  #794

Open
@sasathy1

Description

Is your feature request related to a problem? Please describe.
The mssqldb SDK supports Azure SQL authentication through few different ways:

  1. username/password
  2. service principal
  3. managed identity (through access token)

Would it be possible to support managed identity through token credential as well (ie. something akin to azidentity.ManagedIdentityCredential)?

Reason for the ask
Our system works on the edge in most scenarios, but we need to use MI auth to communicate with Azure SQL in the cloud. We are relying heavily on azure-sdk-for-go since the SDK takes care of doing the heavylifting for us (ie. defining the right scope and calling the appropriate MSI endpoint in the edge). Since we are abstracted from the nitty gritties of fetching the token, it would be easier for us if SQL could support MI Auth through token credential instead of just access token.

Describe the solution you'd like
I am expecting to do something like below to perform MI auth with Azure SQL:

connString := fmt.Sprintf("Server=foo;Database=bar")
cred, _ := azidentity.NewManagedIdentityCredential(nil)
connector, err := mssql.WithTokenCredential(connString,cred)
conn := mssql.OpenDB(connector)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions