Azure / Azure/azure-cli

Authentication failure when uploading large blobs using SAS with create only permissions

Open
#16,899 7 comments 0 reactions 1 assignee Claimed by @Juliehzl View on GitHub
act-codegen-extensibility-squad feature-request Storage
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

**Describe the bug**
Authentication failure when uploading large blobs using SAS (shared access signature) token with "create" only permissions (while upload of small blobs works ok)

**To Reproduce**
```bash
# 1. create test container
az storage container create --account-name -n test
# 2. create small file
head -c 10000000 /dev/urandom > test10M.txt
# 3. create large file
head -c 100000000 /dev/urandom > test100M.txt
# 4. create sas
az storage container generate-sas --account-name -n test --permissions c --expiry $(date -u -v "+7d" '+%Y-%m-%dT%H:%MZ')
# 5. upload of small file - ok
az storage blob upload --account-name -c test --file test10M.txt -n test10M.txt --sas-token
# 6. upload of large file - authentication failure (message below)
az storage blob upload --account-name -c test --file test100M.txt -n test100M.txt --sas-token

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.

```
**Expected behavior**
required permissions for blob upload should not depend on file size

**Environment summary**
Darwin-19.6.0-x86_64-i386-64bit
Python 3.7.9
Installer: PIP

azure-cli 2.9.1

**Additional context**
If SAS has "write" permissions, upload of large files seems to succeed.

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.