无法在Azure blob存储中创建文件夹$ root container

时间:2017-12-16 20:33:18

标签: cors azure-storage-blobs

Azure存储允许使用名为$ root的默认容器 正如in the documentation

所解释的那样

使用Azure门户。当我尝试将脚本文件夹上传到我的$ root容器时,我收到错误

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

我该如何解决这个问题?

我可以上传到不称为$ root的容器 enter image description here

[更新]

我猜SAS意味着共享访问签名。 我用Blob设置了容器(仅对blob进行匿名读访问) 我将尝试Container(容器和blob的匿名读访问)

[更新]

更改访问策略没有任何区别。 $ root不显示访问策略 enter image description here

我知道必须将文件放在新文件夹中才能创建文件夹。这不是那个问题。

[更新]

以下是我的网站blob的样子。我可以为我的网站容器而不是我的$ root容器执行此操作。

enter image description here

1 个答案:

答案 0 :(得分:3)

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