Az Storage Blob Generate SAS Fails when --auth-mode login provided
Below command failed with the following error when I provided --auth-mode login, but did not fail when --auth-mode login was not provided.
Succeeded: az storage blob generate-sas --account-name **** --container-name **** --name 6.2005.24.0 --full-uri --permissions r --expiry 2020-7-13T19:27:4Z --https-only --subscription a710cf97-7a43-4277-b7d4-f34966f537af
Failed: az storage blob generate-sas --account-name **** --container-name **** --name 6.2005.24.0 --full-uri --permissions r --expiry 2020-7-13T19:27:4Z --https-only --subscription a710cf97-7a43-4277-b7d4-f34966f537af --auth-mode login
This is autogenerated. Please review and update as needed.
Describe the bug
Command Name
az storage blob generate-sas
Errors:
self.account_key should not be None.
Traceback (most recent call last):
pip-install-0u_uiwkq\knack\knack\cli.py, ln 206, in invoke
cli\core\commands\__init__.py, ln 608, in execute
cli\core\commands\__init__.py, ln 666, in _run_jobs_serially
cli\core\commands\__init__.py, ln 657, in _run_job
cli\command_modules\storage\__init__.py, ln 257, in new_handler
cli\core\commands\__init__.py, ln 636, in _run_job
cli\core\commands\__init__.py, ln 306, in __call__
azure\cli\core\__init__.py, ln 493, in default_command_handler
command_modules\storage\operations\blob.py, ln 440, in generate_sas_blob_uri
storage\v2018_11_09\blob\baseblobservice.py, ln 521, in generate_blob_shared_access_signature
storage\v2018_11_09\common\_error.py, ln 130, in _validate_not_none
ValueError: self.account_key should not be None.
To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.
- Put any pre-requisite steps here...
az storage blob generate-sas --account-name {} --auth-mode {} --container-name {} --name {} --full-uri --permissions {} --expiry {} --https-only --subscription {}
Expected Behavior
Succeeds
Environment Summary
Windows-10-10.0.19041-SP0
Python 3.6.6
Shell: powershell.exe
azure-cli 2.0.80 *
Extensions:
azure-devops 0.17.0
Additional Context
add to S169
add to S171
@alburgin Thanks for your feedback. It is because only account and connection-string can be used to generate normal sas token. When --auth-mode login is used, you need to enable --as-user, which means that you want to generate user delegation key. BTW, I am refiningthe error message for --auth-mode login part.