Get block when deploy static website to Blob by CLI

Daniel Chang 20 Reputation points
2025-11-10T03:19:21.4633333+00:00

Hi,
My team member has a contributor role in the subscription.
And his cli can check the Blob resource successfully.
However he tried to use

npm run build:azure:staging && az storage blob upload-batch --destination '$web' --source .out --account-name compassstgstatic --auth-mode key --overwrite

to deploy the website to blob.
He get this error.
"The specifed resource name contains invalid characters. RequestId:21517e55-601e-002c-56e2-4e961b000000 Time:2025-11-06T06:02:56.0760706Z ErrorCode:InvalidResourceName"

I can't find any error in Azure console to get more information about this.

Furthermore, I have another account is also assigned as Contributor role and is able to use the same deploy script above to deploy the website successfully to the same Blob.

Can you please tell me how we can identify the error and how to make the deployment work?

Kind regards,

Daniel

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
0 comments No comments
{count} votes

Answer accepted by question author
  1. Priya ranjan Jena 2,295 Reputation points Microsoft External Staff Moderator
    2025-11-10T08:35:23.0333333+00:00

    Hi Daniel Chang,

    Welcome to Microsoft Q&A forum,

    ErrorCode:InvalidResourceName" is thrown by Azure Blob Storage when the destination container name or blob name includes characters that violate naming rules.

    You're targeting the $web container, which is a special container used for static website hosting.

    • $web must be exactly spelled as $web (case-sensitive).
    • It must be quoted properly in CLI to avoid shell interpretation issues

    Shell Interpretation Issue

    If the $web string is not properly quoted, the shell might interpret it as a variable.

    Try using below

    --destination '\$web'
    
    
    

    Check File Names: Ensure that none of the files in your .out directory has invalid characters in its name. Azure Blob Storage has specific rules for naming containers and blobs, including restrictions on special characters.

    If the .out folder contains files with invalid blob names (e.g., names with backslashes, colons, or control characters), the upload will fail.

    Run a check on the filenames:

    ls .out | grep '[^a-zA-Z0-9._-]'
    
    
    

    Account and Container Names: Confirm that the account name (compassstgstatic) and destination container name ($web) are correct and properly formatted.

    CLI Version: Make sure you're using the latest version of the Azure CLI, as older versions might have bugs or compatibility issues. You can update it with the command:

    az upgrade
    
    
    

    Try quoting $web properly:

    az storage blob upload-batch --destination "$web" --source .out --account-name compassstgstatic --auth-mode key --overwrite
    

    Deployment Token: Check if your team member has the correct permissions and deployment token set for uploading to the Blob. Since another account can deploy successfully with the same script, ensure there's no misconfiguration in roles or permissions.

    Hope you find this comment helpful ,if yes, please “up-vote” for the information provided , this can be beneficial to community members.

    Kindly let us know if you have any additional questions.

    Thanks

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Priya ranjan Jena 2,295 Reputation points Microsoft External Staff Moderator
    2025-11-10T04:29:42.7133333+00:00

    Hi Daniel Chang,

    We are currently assessing you issue, will update you once we identify the root cause.

    Thanks

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.