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

Allow authentication to Azure Blob Storage using SAS token #1600

Merged
merged 5 commits into from
Oct 7, 2019

Conversation

frsann
Copy link

@frsann frsann commented Oct 7, 2019

Thanks for contributing to Prefect!

Please describe your work and make sure your PR:

  • adds new tests (if appropriate)
  • updates CHANGELOG.md (if appropriate)
  • updates docstrings for any new functions or function arguments, including docs/outline.toml for API reference docs (if appropriate)

Note that your PR will not be reviewed unless all three boxes are checked.

What does this PR change?

Allows authentication to Azure Blob Storage using SAS tokens. This concerns AzureResultHandler as well as the tasks BlobStorageDownload, BlobStorageUpload, and DatastoreRegisterBlobContainer.

Why is this PR important?

Allows Blob Storage users to authenticate more securely.

@marvin-robot
Copy link
Member

Here I am, brain the size of a planet and they ask me to welcome you to Prefect.

So, welcome to the community @frsann! 🎉 🎉

@codecov
Copy link

codecov bot commented Oct 7, 2019

Codecov Report

Merging #1600 into master will increase coverage by <.01%.
The diff coverage is 100%.

Comment on lines 63 to +66
blob_service = azure.storage.blob.BlockBlobService(
account_name=az_account_name, account_key=az_account_key
account_name=az_account_name,
account_key=az_account_key,
sas_token=az_sas_token,
Copy link

Choose a reason for hiding this comment

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

What happens if both account_key and sas_token are provided? Is it rightfully handled or is an error raised?

Copy link
Author

Choose a reason for hiding this comment

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

Good question.

For Datastore.register_azure_blob_container it basically comes down to a call to azureml.data.datastore_client._DatastoreClient._get_credential_type(account_key, sas_token) which gives preference to account_key. No error.

For BlockBlobService we initiate its base class azure.storage.blob.baseblobservice.BaseBlobService, which follows the same logic; account_key is given preference, and no error.

This functionality should maybe be mentioned in the docstrings?

Copy link

Choose a reason for hiding this comment

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

Yeah! Just add a quick note about preference!

Copy link
Author

Choose a reason for hiding this comment

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

Updated!

Copy link
Member

@cicdw cicdw left a comment

Choose a reason for hiding this comment

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

Excellent - thanks again for your contributions @frsann ! Next time you open a PR, @marvin-robot should be silent now that your commits are signed ✅

@cicdw cicdw merged commit 8dfa97a into PrefectHQ:master Oct 7, 2019
zanieb pushed a commit that referenced this pull request Apr 13, 2022
…-start-date-filters

UI: disable run state filter if it already exists
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

4 participants