Azurite allows underscores in container names; Azure proper disallows them
See original GitHub issueWhich service(blob, file, queue, table) does this issue concern?
Blob.
Which version of the Azurite was used?
3.8.0
Where do you get Azurite? (npm, DockerHub, NuGet, Visual Studio Code Extension)
Docker Hub
What’s the Node.js version?
Whatever comes in the container
What problem was encountered?
Azurite allows the user to create a blob storage container with names which are not allowed by Azure proper.
In particular, I found that Azurite allows underscores in container names, which are not allowed in the real blob storage:
Container names must start or end with a letter or number, and can contain only letters, numbers, and the dash (-) character.
e.g my_test_container
is allowed as a container name in Azurite, but not in Azure.
Steps to reproduce the issue?
Here’s a small Scala program that tries to create a container with an underscore:
import com.azure.storage.blob.{BlobServiceClient, BlobServiceClientBuilder}
val blobServiceClient: BlobServiceClient
blobServiceClient.createBlobContainer("my_test_container")
If I create a client that talks to Azurite, this sets the metadata, and prints the correct metadata when I call getMetadata:
val azureClient: BlobServiceClient =
new BlobServiceClientBuilder()
.connectionString("UseDevelopmentStorage=true;")
.buildClient()
If I run this against our live storage account, I get an error:
Status code 400, "<?xml version="1.0" encoding="utf-8"?><Error><Code>InvalidResourceName</Code><Message>The specifed resource name contains invalid characters.
Removing the underscores (i.e. mytestcontainer
) allows me to create the container.
Have you found a mitigation/solution?
n/a.
I only discovered this bug when writing a repro for https://github.com/Azure/Azurite/issues/532 and figured I’d do the good citizen thing by reporting it, but it’s not affecting my work at all.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
Not sure whether to open this as a new issue, but I’ve just encountered something similar in Azurite 3.12.0 on VS Code - Azurite allows me to create a container with capital letters (ie.
Products
), whereas this fails when running against azure proper.@blueww it looks like that issue was merged after I pulled the docker image! I have updated now and the short names are being rejected as expected!
Thanks for the response!