Skip to content

Enhance error message for SAS token with invalid allowed IP address #19631

@yongjun-chee

Description

@yongjun-chee

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions