az storage container create fails
Describe the bug
Cannot create storage container using az cli.
Command Name
az storage container create
Errors:
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
To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.
- Have existing v2 storage account
- az login with account that has blob owner and contributor access
az storage container create -n {containername} --account-name {existingstorageaccountname}
Expected Behavior
Container is created
Environment Summary
Linux-4.19.59-microsoft-standard-x86_64-with-debian-buster-sid
Python 3.6.5
Shell: bash
azure-cli 2.0.72
Extensions:
azure-devops 0.12.0
front-door 1.0.0
virtual-wan 0.1.0
Additional Context
@matt-FFFFFF Can you check the following two things for your storage account? 1. Contributor role to the storage account, not Storage Blob Data Contributor role. 2. Is there an firewall for your storage account? If everything is right but still failed, can you show me the debug information with --debug appending your command? Please note to hide your personal storage key and any credential information.
I am having this issues as well. My user has both the Contributor and Storage Blob Data Contributor roles on the storage account. There is no firewall for my storage account. Attached is the debug output (minus my keys and identifiers): debug_for_container_access_issue.txt
Hi,
Confirming no firewall and that the account has contributor access to the RG. Will test again with —debut and report back.
I have the exact same issue with brand new storage account, no firewall rules and I'm the owner of the subscription. Very simple flow:
az storage account create --name aaa111 --resource-group abcdefg-rg --location uksouth --sku Standard_LRS
az storage container create --name snapshots --account-name aaa111
I'll just add that the cli prints the following before the exception provided in the first message:
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. Both values of the auth-mode param don't change anything.
@Juliehzl any progress on this?
Hi,
Confirming no firewall and that the account has contributor access to the RG. Will test again with —debut and report back.
Any update for this?
I have the exact same issue with brand new storage account, no firewall rules and I'm the owner of the subscription. Very simple flow:
az storage account create --name aaa111 --resource-group abcdefg-rg --location uksouth --sku Standard_LRS az storage container create --name snapshots --account-name aaa111I'll just add that the cli prints the following before the exception provided in the first message:
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. Both values of the auth-mode param don't change anything.
@Juliehzl any progress on this?
Hi @tamirkamara, for your scenario, you create the storage account successfully, right? So I assume you encounter the error when creating container, can you show me your debug information with --debug?
I am having this issues as well. My user has both the Contributor and Storage Blob Data Contributor roles on the storage account. There is no firewall for my storage account. Attached is the debug output (minus my keys and identifiers): debug_for_container_access_issue.txt
Hi @cherimckeown, for your scenario, the error is caused by 'CannotVerifyCopySource', not authentication error. Sorry for incorrect message and we need to improve the error message soon. dupe of #10656
@Juliehzl planned after Ignite.
@Juliehzl You are right on the error happening on creating the container, but I can't reproduce it anymore. Not sure what changed...
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.