Azure / Azure/azure-cli

Enhance error message for SAS token with invalid allowed IP address

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

Description

### **This is autogenerated. Please review and update as needed.**

## Describe the bug

**Command Name**
`az storage blob download-batch`

**Errors:**
```
You do not have the required permissions needed to perform this operation.
Depending on your operation, you may need to be assigned one of the following roles:
"Storage Blob Data Contributor"
"Storage Blob Data Reader"
"Storage Queue Data Contributor"
"Storage Queue Data Reader"

If you want to use the old authentication method and allow querying for the right account key, please use the "--auth-mode" parameter and "key" value.

'CommandResultItem' object is not iterable
Traceback (most recent call last):
File "/usr/lib64/az/lib/python2.7/site-packages/knack/cli.py", line 212, in invoke
self.output.out(cmd_result, formatter=formatter, out_file=out_file)
File "/usr/lib64/az/lib/python2.7/site-packages/knack/output.py", line 132, in out
output = formatter(obj)
File "/usr/lib64/az/lib/python2.7/site-packages/knack/output.py", line 38, in format_json
input_dict = dict(result) if hasattr(result, '__dict__') else result
TypeError: 'CommandResultItem' object is not iterable
```

## To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

- Create a SAS token with invalid allowed IP address
- `az storage blob download-batch --sas-token={} --auth-mode={} -d {} --pattern {} -s {} --account-name {}`

## Expected Behavior
Error message shouldn't say about the roles to be assigned. Instead, at least it should say that there is a connection issue using the SAS token. (Ideally, give a user hint about `check the Allowed IP address`)

## Environment Summary
```
Linux-3.10.0-1062.el7.x86_64-x86_64-with-redhat-7.7-Maipo
Python 2.7.5
Shell: bash

azure-cli 2.0.74

```
## 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.