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

Remove need to login with azcopy #346

Open
johnbradley opened this issue Mar 11, 2022 · 1 comment
Open

Remove need to login with azcopy #346

johnbradley opened this issue Mar 11, 2022 · 1 comment

Comments

@johnbradley
Copy link
Collaborator

The current Azure Blob Storage code requires that the user previously logged in with the azcopy command for uploading and downloading. Remove this requirement to avoid users needing to login multiple times.

We currently reference the bucket(container)/path with a plain URL:

destination_url = self.get_url(f"{project_path}/{directory_name}")

source_url = self.get_url(project_path)

If we used a SAS URL to reference the bucket(container)/path there would be no need to login with azcopy.
def get_sas_url(self, path, hours=6):
account_name = self.service.account_name
bucket_name = self.file_system.file_system_name
token = self.get_sas_token(hours=hours)
return f"https://{account_name}.blob.core.windows.net/{bucket_name}/{path}?{token}"

We are not currently doing so because the test environment does not currently allow creating SAS URLs.

@johnbradley
Copy link
Collaborator Author

Azure Storage Explorer seems uses different methods to call azcopy.
Here is what it does for downloading a file when SAS is not possible:

export AZCOPY_CRED_TYPE=OAuthToken;
./azcopy login;
./azcopy copy "..non_SAS_URL.../file1.txt" "/tmp/file1.txt" --overwrite=prompt --check-md5 FailIfDifferent --from-to=BlobLocal --recursive --log-level=INFO;
./azcopy logout;
unset AZCOPY_CRED_TYPE;

When creating a SAS URL is possible Azure Storage Explorer creates SAS URLs.

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

No branches or pull requests

1 participant