Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Az storage blob copy start failed #9995

Closed
Sridhart97 opened this issue Jul 22, 2019 · 13 comments
Closed

Az storage blob copy start failed #9995

Sridhart97 opened this issue Jul 22, 2019 · 13 comments
Assignees
Labels
Storage az storage
Milestone

Comments

@Sridhart97
Copy link

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name
az storage blob copy start

Errors:

The command failed with an unexpected error. Here is the traceback:


'CommandResultItem' object is not iterable
Traceback (most recent call last):
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qdpilz60\knack\knack\cli.py", line 212, in invoke
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qdpilz60\knack\knack\output.py", line 132, in out
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qdpilz60\knack\knack\output.py", line 38, in format_json
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.

  • Put any pre-requisite steps here...
  • az storage blob copy start --verbose --account-key {} --account-name {} --destination-blob {} --destination-container {} --source-uri {}

Expected Behavior

Environment Summary

Windows-10-10.0.18362-SP0
Python 3.6.6
Shell: cmd.exe

azure-cli 2.0.69

Additional Context

+++++++++++++++++++++++++++++ENVIORNMENT+++++++++++++++
C:\Sridhar>az --version
azure-cli 2.0.69

command-modules-nspkg 2.0.3
core 2.0.69
nspkg 3.0.4
telemetry 1.0.3

@Sridhart97
Copy link
Author

C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy>az storage blob copy start --account-key d+LndZKnWuMkPpPBSakB99GcKVlzV/Nlg2JETapPtsCNP1AjVBZ+DHFMANNUqc8MEUwX12k5nV99JnS0SmgIAA== --account-name sasneuprdarch01 --destination-blob vm-archive --destination-container WEB-AZu-002 --source-uri https://md-z1jtvlgqwlxw.blob.core.windows.net/421tblncdgxg/abcd?sv=2017-04-17

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 (Preview)"
"Storage Blob Data Reader (Preview)"
"Storage Queue Data Contributor (Preview)"
"Storage Queue Data Reader (Preview)"

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.

The command failed with an unexpected error. Here is the traceback:

'CommandResultItem' object is not iterable
Traceback (most recent call last):
File "C:\Users\VSSADM1\AppData\Local\Temp\pip-install-qdpilz60\knack\knack\cli.py", line 212, in invoke
File "C:\Users\VSSADM
1\AppData\Local\Temp\pip-install-qdpilz60\knack\knack\output.py", line 132, in out
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qdpilz60\knack\knack\output.py", line 38, in format_json
TypeError: 'CommandResultItem' object is not iterable

To open an issue, please run: 'az feedback'

I am one of the administrator in my Azure subscription, still I am unable to execute****

@Kroev
Copy link

Kroev commented Jul 29, 2019

@Sridhart97 or anyone else with sufficient rights:
Please edit or delte the comment above since the account key seems to be in plain text

@Juliehzl
Copy link
Contributor

Please confirm you have the read permission for source resource https://md-z1jtvlgqwlxw.blob.core.windows.net/421tblncdgxg/abcd?sv=2017-04-17. In addition, the string behind ? should be a valid sas token for resource https://md-z1jtvlgqwlxw.blob.core.windows.net/421tblncdgxg/abcd.

@Juliehzl
Copy link
Contributor

Also note that please check firewall setting.

@Juliehzl
Copy link
Contributor

@Sridhart97 What about your problem now?

@yonzhan yonzhan removed the triage label Sep 2, 2019
@haroldrandom haroldrandom added needs-triage This is a new issue that needs to be triaged to the appropriate team. Storage-cli labels Oct 25, 2019
@yonzhan yonzhan added this to the S161 milestone Nov 2, 2019
@yonzhan
Copy link
Collaborator

yonzhan commented Nov 2, 2019

@Sridhart97 was your issue resolved ?

@marrobi
Copy link

marrobi commented Nov 6, 2019

I'm getting the same issues with az storage blob upload . Using a script I have used many times before, last time successfully a couple of months ago, but today it won't work. Tried on multiple machines, different Azure subscriptions all the same. Tried with connection string, SAS token and key, and they all fail with the blob upload command. If use the same token/connection string in storage explorer it connects and can upload data. So feel something must have changed in the CLI.

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.
                
The command failed with an unexpected error. Here is the traceback:

'CommandResultItem' object is not iterable
Traceback (most recent call last):
  File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 212, in invoke
    self.output.out(cmd_result, formatter=formatter, out_file=out_file)
  File "/opt/az/lib/python3.6/site-packages/knack/output.py", line 132, in out
    output = formatter(obj)
  File "/opt/az/lib/python3.6/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

@yonzhan yonzhan added Storage az storage and removed needs-triage This is a new issue that needs to be triaged to the appropriate team. Storage-cli labels Nov 9, 2019
@yonzhan
Copy link
Collaborator

yonzhan commented Nov 9, 2019

@Juliehzl please help with this issue.

@Juliehzl
Copy link
Contributor

Please try with azure cli 2.0.77. It can throw correct error message for your operation and check your command according to error message. Hope it can help you and I will close it now. If you still have problems, feel free to create a new one.

@marrobi
Copy link

marrobi commented Dec 5, 2019

So I hit this and switched to az storage blob upload-batch, which has worked fine for the last month, then today I am getting Authentication failure. This may be caused by either invalid account key, connection string or sas token value provided for your storage account. I updated the cli to 2.0.77, but no change.

This is actually happening when trying to create a container.

The bit of the script in question looks like:

az group create --name $storageRg --location $location

az storage account create \
    --resource-group $storageRg \
    --location $location \
    --sku Standard_LRS \
    --kind StorageV2 \
    --name $storageAccountName

connection=$(az storage account show-connection-string \
    --resource-group $storageRg \
    --name $storageAccountName \
    --query connectionString)
    
az storage container create \
    --name $templateContainer \
    --connection-string $connection

There is something odd happening here.

Thanks.

@marrobi
Copy link

marrobi commented Dec 5, 2019

Using --debug, get:

azure.multiapi.storage.v2018_11_09.common.storageclient : Client-Request-ID=e4378b6c-1699-11ea-95c4-00155dc3f99e Retry policy did not allow for a retry: Server-Timestamp=Thu, 05 Dec 2019 09:46:53 GMT, Server-Request-ID=69b57144-201e-0013-1450-ab5a4d000000, HTTP status code=403, Exception=Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. ErrorCode: AuthenticationFailed<?xml version="1.0" encoding="utf-8"?><Error><Code>AuthenticationFailed</Code><Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.RequestId:69b57144-201e-0013-1450-ab5a4d000000Time:2019-12-05T09:46:54.0601128Z</Message><AuthenticationErrorDetail>Request date header too old: 'Wed, 04 Dec 2019 13:28:00 GMT'</AuthenticationErrorDetail></Error>.
cli.azure.cli.core.util : 
Authentication failure. This may be caused by either invalid account key, connection string or sas token value provided for your storage account.
                    

Authentication failure. This may be caused by either invalid account key, connection string or sas token value provided for your storage account.

So:

<AuthenticationErrorDetail>Request date header too old: 'Wed, 04 Dec 2019 13:28:00 GMT'</AuthenticationErrorDetail>

Given I am running this all at once, not sure how this can be an issue.

@marrobi
Copy link

marrobi commented Dec 5, 2019

Interesting, using WSL, the time is incorrect:
image

@marrobi
Copy link

marrobi commented Dec 5, 2019

Believed root cause: microsoft/WSL#4245

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Storage az storage
Projects
None yet
Development

No branches or pull requests

7 participants