"404 Resource Not Found" From Azure Blob Storage Document from PUT
Asked Answered
B

5

52

During a PUT request, with the proper Authorization header, which creates a new BLOB, my process is getting a "404 Resource Not Found" error when I attempt to PUT a file into a container.

https://accountNameHere.blob.core.windows.net/containerNameHere

The container name and the account name are both correct.

Why is it failing?


Here are raw request headers:

PUT /testss HTTP/1.1
Host: accountName.blob.core.windows.net
Accept: */*
Connection: Keep-Alive
0: content-encoding
1: content-language
2: content-length
3: content-md5
4: content-type
5: date
6: if-modified-since
7: if-match
8: if-none-match
9: if-unmodified-since
10: range
x-ms-blob-type: BlockBlob
x-ms-version: 2011-08-18
x-ms-date: Fri, 09 Aug 2013 04:17:59 GMT
Content-Length: 126377
Authorization: SharedKey accountName:MBVLmoxzxZr+tf8EZw2GkbFLEHuNn8FNAaEHrcty/cM=
Expect: 100-continue

Here is the string to sign that I sent:

PUT x-ms-blob-type:BlockBlob x-ms-date:Fri, 09 Aug 2013 04:03:20 GMT x-ms-version:2011-08-18 /accountName/test

And here is what they expected:

PUT 126377 x-ms-blob-type:BlockBlob x-ms-date:Fri, 09 Aug 2013 04:02:17 GMT x-ms-version:2011-08-18 /accountName/test

The only difference between the two is the 126377 after PUT. That's the content length of the file, I'm just not sure how to remove it.

Banjo answered 9/8, 2013 at 2:51 Comment(0)
D
41

1 - In the Azure Storage Explorer application do these steps to change/verify access.

  1. Right click the container's blob in question
  2. Select Set Public Access Level
  3. Set to at least Public read access for blobs only.
  4. Apply.

enter image description here


OR 2 - or In the Azure Portal Panel select

  • Storage account >
  • from Blob service Section Select "Blob" >
  • Select Blob or Blobs that you want to change the access permission >
  • Select "Access policy" >
  • from the Drop Down menu select "Blob" or "Container" anonymous access based on your needs
Doting answered 22/1, 2019 at 15:29 Comment(1)
Champion! I needed a hero and you're it. Thanks!Nathanaelnathanial
F
34

Have you checked the security settings of the Blob container? It might be that you don't have enough access rights.

Fogg answered 30/3, 2015 at 13:21 Comment(2)
check Blob service > Container > Access PolicyZins
Thank you @Yar! ----- I changed the access level of my container from Private (non anonymous access) to Container (anonymous read access for containers and blobs) and it worked for me.Turnkey
Q
14

Check your container. In the new portal, click the ellipses next to it and Edit. Then set the Access type to either Blob or Container if you want to allow listing of the container.

Microsoft seems to have bumped up the security and made new containers private by default.

Quintuplet answered 20/7, 2015 at 10:29 Comment(2)
Thank you very much for this answer. I was struggling as to why I could see a Blob in my Container, but could not hit the URL and download it in a browser. What is the difference between Access type "Blob" vs "Container", do you happen to know?Underage
@PhilipTenn Blob means the blob is public but not the container, Container means the both the container and blobs are public....Quintuplet
C
1
  1. Select your storage account
  2. Select Container
  3. Check the checkbox of your container
  4. Click on Change Access level

Follow 1 - 4 steps from the picture

  1. After clicking on the button Change Access level, you will see the below screen
  2. Change the option as per your requirement.

Change the access

Celebrate answered 19/9, 2021 at 18:33 Comment(1)
The access should be granted for users only. No public access should be allowedBandoleer
M
0

You should use Fiddler to verify that you are sending the request you think you are. You can then compare the Fiddler request with the documentation.

Does the container already exist? It is worth using a 3rd-party storage explorer to verify that it does.

Mislike answered 9/8, 2013 at 3:24 Comment(5)
Just installed Fiddler, soon as I get it going I'll let you know what I find. Yeah the container already exists, I created it manually.Banjo
just edited the question with info from Fiddler. Thanks for your help on this.Banjo
Figured it out. The PHP SDK from Microsoft is absolutely horrendous. It's truly terrible. They are at fault. I'm working to fix it and then I'll submit pull requests. Thanks for your help.Banjo
Can you share what problem you found?Yonatan
Can supposedly send a pull request to Azure, cannot share his solution on SO.Touraine

© 2022 - 2024 — McMap. All rights reserved.