I'm storing blobs in a private container which will generate a new shared access signature each time an authorized users request to view. If a shared access signature is generated by authorized user, a valid link with token is appended to blob's tail, then everyone can view it with no trouble (including un-authorized users). This is unexpected. I just want that valid link can be viewed by user who generated that token only
How can I secure my blobs without unauthorized access for generated token?
P/s: My requests come from other domain, different from azure storage domain
You can restrict the blob container by generating an SAS token with
IP address.To ensure that only the authorized user can access the blob with the generated SAS token, you need to set the appropriate permissions on the SAS token. Specifically, you should set the
Readpermission on the token and also set theIPRangeproperty to the IP address of the authorized user.Initially, I set up an IP address for the storage account.
You can use the below code to generate a SAS token with Authorized IP address.
Code:
Output:
If we try with a different Ip address you will get an error like below:
Reference:
AccountSasBuilder Class (Azure.Storage.Sas) - Azure for .NET Developers | Microsoft Learn