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

Use DefaultAzureCredential for azure storage and discourage connectionString #195

Merged
merged 5 commits into from
Apr 23, 2024

Conversation

inthemedium
Copy link
Contributor

@inthemedium inthemedium commented Apr 22, 2024

Use DefaultAzureCredential for azure storage and discourage connectionString

  1. To use DefaultAzureCredential, we must pass in a URI to the storage account. There is no constructor with a connection string.
  2. Using shared keys is highly discouraged by all the docs. I can provide links if needed.
  3. Managed Identities "just work"
  4. By default, DefaultAzureCredential does not do interactive authentication.
  5. Much of the AzureCredential configuration can be accomplished with environmental variables. I didn't come up with a strategy to use a different AzureCredential per source. This could be done with some more changes to the config files but I suspect YAGNI :-)

doc/client-settings.md Outdated Show resolved Hide resolved
{
baseUri = pathUri;
}
var blobServiceClient = string.IsNullOrWhiteSpace(connectionString)
Copy link
Contributor Author

@inthemedium inthemedium Apr 22, 2024

Choose a reason for hiding this comment

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

This is the beating heart of this change.

A few comments:

  1. To use DefaultAzureCredential, we must pass in a URI to the storage account. There is no constructor with a connection string.
  2. Using shared keys is highly discouraged by all the docs. I can provide links if needed.
  3. Managed Identities "just work"
  4. By default, DefaultAzureCredential does not do interactive authentication.
  5. Much of the AzureCredential configuration can be accomplished with environmental variables. I didn't come up with a strategy to use a different AzureCredential per source. This could be done with some more changes to the config files but I suspect YAGNI :-)

{
throw new ArgumentException("Missing connectionString for azure account.");
await log.LogAsync(LogLevel.Warning, "connectionString is deprecated for azure account. Use path instead.");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I needed to change many files to get a hold of this logger. I can make this a separate PR if needed.

@inthemedium
Copy link
Contributor Author

TODO, need to run tests and do manual testing.

@inthemedium inthemedium marked this pull request as ready for review April 22, 2024 22:38
@inthemedium inthemedium changed the title Use DefaultAzureCredential for azure storage and deprecate connectionString Use DefaultAzureCredential for azure storage and discourage connectionString Apr 23, 2024
Copy link
Owner

@emgarten emgarten left a comment

Choose a reason for hiding this comment

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

Looks great 💯

@emgarten
Copy link
Owner

I'll run the functional tests on the CI and verify that the tests with a connection string are still working.

@emgarten
Copy link
Owner

Full functional tests passed ✅

@emgarten emgarten merged commit 8f82d9c into emgarten:main Apr 23, 2024
9 checks passed
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.

2 participants