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

Azure: support user delegation key #1063

Merged
merged 2 commits into from
Oct 7, 2021
Merged

Azure: support user delegation key #1063

merged 2 commits into from
Oct 7, 2021

Conversation

dimbleby
Copy link
Contributor

@dimbleby dimbleby commented Oct 2, 2021

I just noticed that #805 had been merged! Very happy to see it, thank you.

While that has been waiting, I have been running with a variation on the Azure storage code that adds support for user delegation keys. This allows us to hand out URLs after using a managed service identity to authenticate with the blob store, rather than an account key. Once you have set up your Azure resources appropriately, the configuration looks something like this:

from azure.identity import DefaultAzureCredential
AZURE_TOKEN_CREDENTIAL = DefaultAzureCredential()
AZURE_ACCOUNT_NAME = "myaccount"
AZURE_CONTAINER = "my-container"
...

Since getting a user delegation key requires use of the BlobServiceClient I've also refactored the creation of the ContainerClient ever so slightly to reuse that. I must admit I had my doubts about the value of this refactoring when I came to polish this into an MR and realized that I'd have to fix up the resulting unit test breakage! but I do think it is the cleanest way.

@jschneier
Copy link
Owner

Is there any need to update the documentation for this feature?

@dimbleby
Copy link
Contributor Author

dimbleby commented Oct 6, 2021

I don't think this needs additional documentation. From a user perspective, it's just a fix: using managed service identities works now, in cases where it didn't previously.

@jschneier jschneier merged commit 86bb44a into jschneier:master Oct 7, 2021
mlazowik pushed a commit to qedsoftware/django-storages that referenced this pull request Mar 9, 2022
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.

None yet

2 participants