azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

Az storage blob sync requests an account key when an sas token is provided

Open sandriches opened this issue 5 years ago • 6 comments

Describe the bug

Az storage blob sync requires an account key when an SAS token is provided. SAS token was tested with another command (az storage blob list), which works fine.

Command Name az storage blob sync

Errors:

self.account_key should not be None.
Traceback (most recent call last):
python3.6/site-packages/knack/cli.py, ln 233, in invoke
    cmd_result = self.invocation.execute(args)
cli/core/commands/__init__.py, ln 664, in execute
    raise ex
cli/core/commands/__init__.py, ln 727, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
cli/core/commands/__init__.py, ln 719, in _run_job
    return cmd_copy.exception_handler(ex)
...
storage/v2018_11_09/common/cloudstorageaccount.py, ln 194, in generate_shared_access_signature
    _validate_not_none('self.account_key', self.account_key)
storage/v2018_11_09/common/_error.py, ln 130, in _validate_not_none
    raise ValueError(_ERROR_VALUE_NONE.format(param_name))
ValueError: self.account_key should not be None.

To Reproduce:

  • az storage container generate-sas --account-name {} --name {} --permissions acdlrw --expiry (date + 1 hour)
  • az storage blob sync -s {} --container {} --account-name {} --sas-token {}

Expected Behavior

Sync should occur without the need to provide an account key (insecure).

Environment Summary

Linux-4.15.0-135-generic-x86_64-with-debian-buster-sid
Python 3.6.10
Installer: DEB

azure-cli 2.19.1

Extensions:
azure-devops 0.18.0
storage-preview 0.6.0

Additional Context

sandriches avatar Feb 12 '21 16:02 sandriches

storage

yonzhan avatar Feb 12 '21 23:02 yonzhan

This used to work in version 2.18 of the CLI.

mikeysteele avatar Feb 19 '21 00:02 mikeysteele

This used to work in version 2.18 of the CLI.

Thanks @mikeysteele feedback! Currently you could use 2.18.0 as a workaround and we will fix it in next version which will be released on 3/2.

Juliehzl avatar Feb 19 '21 01:02 Juliehzl

There are edge builds with fix available now. Could you try to install edge builds according to https://github.com/Azure/azure-cli#edge-builds and try again?

Juliehzl avatar Feb 19 '21 07:02 Juliehzl

@Juliehzl we started getting this error in Azure Pipelines this morning (which uses 2.19.1 in their ubuntu-latest Hosted Agent). We didn't make any changes and started seeing this error about 4 hours ago.

I was able to install Azure CLI 2.20.0 over it in Azure Pipelines but I am still getting the error.

I filed a new issue #17176 since that refers to sas-generate and was not sure if it's related to this one.

adiun avatar Mar 02 '21 19:03 adiun

@adiun I have tested in my machine and it works as expected: image

Could you check if azure cli 2.20.0 is is installed in your machine with az --version? It seems you cannot change azure cli version in ADO. And you could also test in you local machine to see if it is fixed now.

Juliehzl avatar Mar 03 '21 09:03 Juliehzl