azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

Not sure how to resolve storage blob upload error

Open chenlomis opened this issue 6 years ago • 5 comments

az feedback auto-generates most of the information requested below, as of CLI version 2.0.62

Describe the bug Trying out QS on creating/uploading/downloading blob but unable to resolve error

To Reproduce Doc here: https://docs.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-cli This is the command that failed: image image

Expected behavior No error with upload success

Environment summary working on CMD, on cli version 2.7.0 image

Additional context

Some other weird behavior that I can't list storage container after creating it... image

chenlomis avatar Aug 13 '20 22:08 chenlomis

add to S175

yonzhan avatar Aug 13 '20 22:08 yonzhan

Hi @chenlomis, thanks for your feedback. Listing containers is data plane operations and will need specific credentials provided and we have a plan to migrate to mgmt plane, which will not require specific credentials for container level operations.

For uploading error, the value of --file is local file path. You should make sure your local path have the file named helloworld.

Juliehzl avatar Aug 14 '20 02:08 Juliehzl

@Juliehzl Thanks for the investigation! Surprisingly I actually do have the helloworld file in the directory... And gave it another try given your recommendation But it seems like there's additional permissions needed/required ... image

chenlomis avatar Aug 14 '20 17:08 chenlomis

It is because you doesn't grant RBAC roles for your storage account. To grant rbac roles, you could refer to the document here https://docs.microsoft.com/en-us/azure/storage/common/storage-auth-aad-rbac-portal in portal and https://docs.microsoft.com/en-us/azure/storage/common/storage-auth-aad-rbac-cli?toc=/azure/storage/blobs/toc.json in azure cli.

I will recommend you to grant at least Storage Blob Data Contributor for upload opetaion.

In addition, you could also use account key and sas token as credential which will not need special rbac roles. For storage command usage, you could refer to here https://github.com/Azure/azure-cli/blob/3113258ba38f0415cae2c30347491030e76c08f4/doc/use_cli_effectively.md#using-storage-commands.

Juliehzl avatar Aug 17 '20 02:08 Juliehzl

Thanks! Let me give that a try Was rather surprised by the steps to take before executing the upload Appreciate the help

chenlomis avatar Aug 21 '20 15:08 chenlomis