Repository navigation
Feature/sas token final - #13140
Feature/sas token final#13140
Conversation
daniel-goldstein
left a comment
There was a problem hiding this comment.
My apologies for all the conflicts with your old branch! Thanks a lot for this contribution, this looks great.
|
@gregsmi Looks like the scopes we currently have set are insufficient for reading the storage account keys. Do you know best practice permissions for creating SAS tokens? |
|
ah yes - the identity used to create the SAS token needs to have a control plane role on the Storage Account - Owner, Contributor, or (most specific) Storage Account Key Operator Service Role... Is that a manageable role to configure for testing or should I try to explore alternatives in the generation? |
Thanks! This is totally fine, I'll just configure the SP that we use for the inter-cloud tests with the key operator role and re-run the tests. |
Note this PR replaces the previous Feature/sas token merge because the original PR branch got jacked up beyond repair. All the comments on the earlier PR are responded to there and addressed in the code for this one.
This PR is to enable
hail-az/httpsAzure file references to contain SAS tokens to enable bearer-auth style file access to Azure storage. Basic summary of the changes:AzureAsyncFSurl parsing function to look for and separate out a SAS-token-like query string. Note: made fairly specific to SAS tokens - generic detection of query string syntax interferes with glob support and '?' characters in file namesgenerate_sas_tokenconvenience function toAzureAsyncFS. Adds new azure-mgmt-storage package requirement.AzureAsyncFSto use(account, container, credential)tuple as internalBlobServiceClientcache keyAzureAsyncFSURLandAzureFileListEntryto track the token separately from the name, and extend the base classes to allow returning url with or without a tokenRouterFS.lsfunction and associated listfiles function to allow for trailing query strings during path traversalAsyncFS.open_fromfunction to handle query-string urls in zero-length caseLocalAsyncFSURL.__str__no longer returns 'file:' prefix. Done to makestr()output be appropriate for input tofsfunctions across all subclassesInputResourceto not include the SAS token as part of the destination file nameinter_cloud/test_fs.pyto generically use query-string-friendly file path building functions to respect the new model, where it is no longer safe to extend URLs by just appending new segments with+ "/"because there may be a query string, and added'sas/azure-https'test case to the fixture. Running tests for the SAS case requires some new test variables to allow the test code to generate SAS tokens (build.yaml/test_hail_python_fs):