8

ERROR: The specifed resource name contains invalid characters. ErrorCode: InvalidResourceName

2019-10-31T10:28:17.4678189Z <?xml version="1.0" encoding="utf-8"?><Error><Code>InvalidResourceName</Code><Message>The specifed resource name contains invalid characters.

2019-10-31T10:28:17.4678695Z RequestId:

2019-10-31T10:28:17.4679207Z Time:2019-10-31T10:28:17.4598301Z</Message></Error>

I am trying to deploy my static website to blob storage in azure with azure DevOps, but I am getting this error. In my pipeline, I am using grunt build to build, and archive it to zip, then publishing to the azure pipeline, then in the release, I am extracting files, and trying to upload these files with azure CLI task.

I am using following command az storage blob upload-batch --account-name something --account-key something --destination ‘$web’ --source ./

My Container name is $web

Mahesh Kumar
  • 111
  • 1
  • 1
  • 4
  • 1
    provide more informartion and describe your error – JuNe Oct 31 '19 at 12:01
  • 6
    probably your blob\container name contain capital letters or dashes or something similar, you are only allowed to use [a-z0-9] in your storage\container\blob names – 4c74356b41 Oct 31 '19 at 12:14
  • I have enabled static web site in an azure storage account, afterward, $web container automatically created in containers. I am only providing '$web' destination in CLI command, I have checked it, I didn't use _ or capitals characters – Mahesh Kumar Oct 31 '19 at 12:19
  • I am getting the same error to read Azure File Storage or File Containers from Logic APP. Please let me know if anyone has a solution to that. – Riddhi Sanyal Apr 12 '21 at 08:18

5 Answers5

24

Permitted characters are lowercase a-z 0-9 and single, infix, hyphens

[a-z0-9\-]

https://learn.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata

Chris F Carroll
  • 11,146
  • 3
  • 53
  • 61
14

I solved this problem by removing apostrophes around container name: az storage blob upload-batch --account-name something --account-key something --destination $web --source ./

  • 1
    Thank you! I had the exact same problem, spent 4 hours on this, would probably spend 4 more if it wasn't for this answer :) – Thomas Oct 28 '20 at 11:27
0

This will probably not solve your problem, but it will solve a related problem for other people:

If the aim is to simply download a file from Azure File Storage using a link, after generating a SAS token, as shown here: Azure File Storage URL in browser showing InvalidHeaderValue

If you remove the slash after the name of the file in the generated link, the file will download!

enter image description here

Diego
  • 117
  • 11
0

verify container name or coonection string might contain extra/nonallowed symbols... In my case it was having extra spaces in container name

0

I had the same problem and it was caused by an incorrect container name