Skip to content
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

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

Merged
merged 3 commits into from
Jul 19, 2021

Conversation

usemam
Copy link
Contributor

@usemam usemam commented Jun 19, 2021

No description provided.

Copy link
Member

@cgillum cgillum left a comment

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
Copy link
Contributor Author

usemam commented Jun 22, 2021

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
Copy link
Contributor Author

usemam commented Jun 27, 2021

@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
Copy link
Member

cgillum commented Jul 2, 2021

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
Copy link
Member

cgillum commented Jul 19, 2021

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