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

Add DefaultAzureCredential as an authentication option for Azure #293

Closed
joshuajohananorthos opened this issue May 13, 2024 · 2 comments
Closed
Labels
enhancement New feature or request

Comments

@joshuajohananorthos
Copy link

Feature Description

Currently there are two ways to authenticate with Azure: 1. CONN_STR or 2. SAS_SVC_URL. I am asking for one more option: DefaultAzureCredential.

We currently use Workload Identity in Kubernetes to spin up a container in the context of an Azure account. We can then connect to Azure using the default credentials to access resources. We do not have to pass any connection information to the container. Essentially connection information is in the environment that the SDK can use to connect.

Here is an example in Python using the Python SDK that works in our environment:

# in the middle of a function to handle a file
    credential = DefaultAzureCredential()
    client = BlobClient.from_blob_url(file, credential)

I am not a Go developer, but it appears that the Azure blob SDK has a similar function at https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob#NewClient. It takes a credential from azidentity module.

In the azidentity module there is a default Azure credential: https://learn.microsoft.com/en-us/azure/developer/go/azure-sdk-authentication?tabs=bash#authenticate-to-azure-with-defaultazurecredential

@joshuajohananorthos joshuajohananorthos added the enhancement New feature or request label May 13, 2024
@flarco
Copy link
Collaborator

flarco commented May 15, 2024

Done. Should be good for upcoming release (#289) this weekend.
Would be nice if you could compile the binary on branch v1.2.10 (steps here) to test to confirm it works.
Closing for now.

@flarco flarco closed this as completed May 15, 2024
@flarco flarco mentioned this issue May 15, 2024
@joshuajohananorthos
Copy link
Author

I just tested this locally and it works exactly how I expected. I only have to specify the type, account, and container and sling will pick up the credentials from the environment.

I still need to run this in containers, but I trust DefaultAzureCredential will work there as well.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants