Skip to content

#32 Microsoft.Data.SqlClient v3.0.0 - #33

Merged
cgillum merged 3 commits into
microsoft:mainfrom
usemam:sql-client-update
Jul 19, 2021
Merged

#32 Microsoft.Data.SqlClient v3.0.0#33
cgillum merged 3 commits into
microsoft:mainfrom
usemam:sql-client-update

Conversation

@usemam

@usemam usemam commented Jun 19, 2021

Copy link
Copy Markdown
Contributor

No description provided.

@cgillum cgillum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR. I see you've removed the managed identity settings. How does managed identity work with the new v3.0.0 dependency? Can you provide some sample code that shows configuring an app with the SqlOrchestrationService with support for managed identities?

@usemam

usemam commented Jun 22, 2021

Copy link
Copy Markdown
Contributor Author

Based on this PR I assumed that managed identity parameters used for authentication now go through connection string.
I do apologize, but I can't currently check this assumption unfortunately - using my personal Azure subscription it will require spinning up AD domain, and I'm not sure that I have the knowledge (or resource) to do that right now. I will look into possible work-around for this.

@usemam

usemam commented Jun 27, 2021

Copy link
Copy Markdown
Contributor Author

@cgillum
After some more source code exploration, I was able to test my assumption, using custom Azure AD domain, Ubuntu 20.04 VM and Azure SQL database. I used this tutorial to setup VM and database.

Here's the code I ran on VM:

using System;
using System.Data.Common;
using Microsoft.Data.SqlClient;

namespace test_prog
{
    class Program
    {
        static void Main(string[] args)
        {
            using (var connection = new SqlConnection("Data Source = durable-sql.database.windows.net; Initial Catalog = DurableDB; Authentication = ActiveDirectoryManagedIdentity"))
            {
                connection.Open();
                using (var cmd = new SqlCommand())
                {
                    cmd.CommandText = "create table test_table(id int);";
                    cmd.Connection = connection;
		    cmd.ExecuteNonQuery();
                }
                Console.WriteLine("Hello World!");
            }
        }
    }
}

Looks like (in the simplest case at least) things like AuthorityHost and TenantId are not required to be provided in connection string (and I'm not sure they can be right now).

@cgillum

cgillum commented Jul 2, 2021

Copy link
Copy Markdown
Member

Excellent! Thank you for verifying! I'll do a bit more verification as well and then merge this PR. I'm very happy that the SQL client team made it much easier to integrate with managed identities.

@cgillum

cgillum commented Jul 19, 2021

Copy link
Copy Markdown
Member

Had a chance to do my own testing and everything looks great. I specifically tested locally using Authentication=Active Directory Default which is designed to work both locally and in Azure.

I've updated this PR to include a couple items in CHANGELOG.md. Thanks again for this contribution!!

@cgillum
cgillum merged commit f0a0573 into microsoft:main Jul 19, 2021
@cgillum cgillum linked an issue Jul 19, 2021 that may be closed by this pull request
@usemam
usemam deleted the sql-client-update branch July 23, 2021 17:17
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.

Update Microsoft.Data.SqlClient dependency to v3.0.0

2 participants