简体   繁体   中英

Is there Azure SAS storage restrictions by content type and size?

When creating a pre-signed url (SAS token) for a blob storage object with read/write access, I'd like to limit the content type and size of the item being uploaded by someone.

Is there such an ability?

https://learn.microsoft.com/en-us/azure/storage/common/storage-sas-overview

No. The restrictions available for SAS are permissions, start/end dates and IP address.

If you want to limit the content type and size, you would have to handle it on your own.

One possible way would be to get the SAS token on demand for the file user is trying to upload. When a user tries to upload a file, first thing you would do is take the file metadata (size, content type) and hit an API endpoint. This API endpoint will validate the metadata and if everything is correct it will return the SAS URL for that file otherwise return an error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM