GetSaSForBlobContainer(container,SharedAccessBlobPermissions.List|SharedAccessBlobPermissions.Read);
public static string **GetSaSForBlobContainer**(CloudBlobContainer blobContainer, SharedAccessBlobPermissions permission)
{
var sas = blobContainer.GetSharedAccessSignature(new SharedAccessBlobPolicy()
{
Permissions = permission,
SharedAccessStartTime = DateTime.UtcNow.AddMinutes(-5),//SAS Start time is back by 5 minutes to take clock skewness into consideration
SharedAccessExpiryTime = DateTime.UtcNow.AddMinutes(15),
});
return string.Format(CultureInfo.InvariantCulture, "{0}{1}", blobContainer.Uri, sas);
}
-- When I try this, my container access in my stroge account is private.Can I list blobs in the container with Internet Explorer ? I try with blob and container access types the fail is always :
AuthenticationFailed
Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. RequestId:2c504f81-0001-00ea-3815-be7271000000 Time:2017-04-25T22:47:20.9382490Z Signature did not match. String to sign used was rl 2017-04-25T22:38:15Z 2017-04-25T22:58:15Z /blob/onlineeducation/$root 2015-12-11
But when I try this I can see the blobs ,
foreach (IListBlobItem blob in blobs)
{
CloudBlockBlob blob1 = new CloudBlockBlob(blob.Uri);
string name = blob1.Name;
}
1-) I dont understand one thing when I create GetSaSForBlobContainer and my container access type is private what will happen (for Internet Explorer and code) ?.
2-) When I get reference without permission my private container, and then create blob uri + SAS.Example what will happen can I see my containers ? or can I only write referenced blob (my blob permission is only write)..
3-What will happen, Container uri + sas - Blob uri + sas (Permission is read) => Can I only upload the file or can I see the containers when try in Internet Explorer .
4-)What is the different here ,
My container access type is private in my storage I get the reference of continer without any permssion and SAS, and then create blob URI with read permssion and SAS .
Container acces type is private in my storage I get the reference of container with permssion and SAS, and then create blob URI with read permssion and SAS
Explorer
? Do you mean Microsoft's Azure Storage Explorer or Internet Explorer (browser)? – Gaurav Mantri