There is no sub container(directory) in Azure blob storage. I simply use slashes in file name for having virtual sub directory.
here is example.
http://apolyonstorage.blob.core.windows.net/banners/Local/Homepage/index.html
Container Name: banners
File Name : Local/Homepage/index.html
I upload the file and access it on Azure portal but simply accessing the link fail by telling resource is not found but it is actually exist.
Why it fails when i access it on browser by link ?
What's the ACL on the blob container? For a blob to be accessible directly via URL (or in other words anonymous access, blob container's ACL should be either Blob
or Public
.
You can use the sample code below to change the container's ACL:
CloudStorageAccount account = new CloudStorageAccount(new StorageCredentials(StorageAccount, StorageAccountKey), true);
CloudBlobClient blobClient = account.CreateCloudBlobClient();
var container = blobClient.GetContainerReference("your-container-name");
BlobContainerPermissions permissions = new BlobContainerPermissions()
{
PublicAccess = BlobContainerPublicAccessType.Blob,//Or BlobContainerPublicAccessType.Container
};
container.SetPermissions(permissions);