0
votes

Azure storage allows for a default container called $root As explained in the documentation

Using the Azure Portal. When I try to upload a scripts folder to my $root container I get the error

upload error for validate-form.js
Upload block blob to blob store failed:
Make sure blob store SAS uri is valid and permission has not expired. 
Make sure CORS policy on blob store is set correctly. 
StatusCode = 0, StatusText = error

How do I fix this?

I can upload to containers that are not called $root enter image description here

[Update]

I guess SAS means Shared Access Signature. I set up the container with Blob ( anonymous read access for blobs only) I will try Container ( anonymous read access for containers and blobs)

[Update]

Changing the access policy made no difference. The access policy is not displayed for $root enter image description here

I am aware that one must put a file in a new folder in order for the folder to create. This is not that issue.

[Update]

Here is what my website blob looks like. I can do this for my website container but not my $root container.

enter image description here

1

1 Answers

3
votes

As Create a container states as follows:

  • Container names must start with a letter or number, and can contain only letters, numbers, and the dash (-) character.
  • Every dash (-) character must be immediately preceded and followed by a letter or number; consecutive dashes are not permitted in container names.
  • All letters in a container name must be lowercase.
  • Container names must be from 3 through 63 characters long.

AFAIK, when managing your blob storage via Azure Storage Client Library, we could not create the container with the name $root. Also, you could leverage Azure Storage Explorer to manage your storage resources, and I assume that the limitation for creating the name for your blob container is applied.

But I tested it on azure portal and found that I could encounter the same issue as you mentioned. I could create the container with the name $root. And I could upload files to the root virtual directory via Azure Portal and Azure Storage Explorer. I assumed that the container name starts with $ is reserved by Azure and we could not create it. And you need to follow the limitation for container names, then you could upload your files as usual. The behavior on azure portal for creating the container name starts with $ is unusual. You could send your feedback here.

UPDATE:

As you mentioned about Working with the Root Container:

A blob in the root container cannot include a forward slash (/) in its name.

So you could not create virtual folder(s) under the Root Container as the normal blob container.

For example: https://myaccount.blob.core.windows.net/$root/virtual-directory/myblob, the blob name would be virtual-directory/myblob, but it is invalid and you could not create it.

UPDATE2:

Have you been able to create a folder within the $root container? If so can you tell me how to please.

We could not create a folder within the $root container, because the root container has the limitation for blob name. You could not treat azure blob storage as the file system, the folder info belongs to the blob name as follows:

enter image description here

enter image description here