Azure / Azure/azure-cli

Error when generating sas-token with auth-mode login

Open
#22,705 2 comments 0 reactions 1 assignee Claimed by @evelyn-ys View on GitHub
act-codegen-extensibility-squad Auto-Assign customer-reported Storage
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

## Describe the bug

**Command Name**
`az storage container generate-sas`

**Errors:**
```
self.account_key should not be None.
Traceback (most recent call last):
python3/dist-packages/knack/cli.py, ln 206, in invoke
cmd_result = self.invocation.execute(args)
cli/core/commands/__init__.py, ln 608, in execute
raise ex
cli/core/commands/__init__.py, ln 666, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
...
storage/v2018_11_09/blob/baseblobservice.py, ln 421, in generate_container_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:
If I run the command without `--auth-mode login` it works, but I get the following warning:
```
No connection string, account key or sas token found, we will query account keys for your storage account. Please try to use --auth-mode login or provide one of the following parameters: connection string, account key or sas token for your storage account.
```

If I *do* add the `--auth-mode login` I get the error described above.

- `az storage container generate-sas --subscription {} --account-name {} -n {} --https-only --permissions {} --expiry {} --start {} --auth-mode login`

## Expected Behavior
Expected to get a generated key returned, without any warnings.

## Environment Summary
```
Linux-5.13.0-1025-azure-x86_64-with-glibc2.29
Python 3.8.10
Shell: bash

azure-cli 2.0.81

Extensions:
azure-devops 0.17.0

```
## Additional Context

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.