Problem
Error when I call the below GET api.
Does it have to do with that sr=d and sdd=4 in the url? I have another url where sr=c and has no sdd and that works when I make a GET request.
Endpoint GET Request
https://myaccount.blob.core.windows.net/xxx/yyy/zzz/xxx/yyy/?sp=rl&st=2022-08-01T12:19:00Z&se=2022-10-01T12:19:00Z&spr=https&sv=2021-06-08&sr=d&sig=xxxxxx&sdd=4&comp=list&restype=container
Error
<?xml version="1.0" encoding="utf-8"?>
<Error>
<Code>InvalidUri</Code>
<Message>The requested URI does not represent any resource on the server.
RequestId:1f1dda37-c01e-0118-457d-b24d16000000
Time:2022-08-16T14:35:50.3635803Z</Message>
</Error>
Expected Output
Able to list the files in the container
Please change your request URL to
https://myaccount.blob.core.windows.net/xxx?sp=rl&st=2022-08-01T12:19:00Z&se=2022-10-01T12:19:00Z&spr=https&sv=2021-06-08&sr=d&sig=xxxxxx&sdd=4&comp=list&restype=container&prefix=yyy/zzz/xxx/yyy/
Above URL assumes that your container name is xxx and you want to list blobs in yyy/zzz/xxx/yyy/ virtual folder.
Also, your signed resource should be c (for blob container).
Please see this link for more details: https://learn.microsoft.com/en-us/rest/api/storageservices/list-blobs.
Related
This is the error showing in browser when I hit the url of container:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
ResourceNotFound
The specified resource does not exist. RequestId:3fc3c275-301e-000f-3193-f99692000000 Time:2022-11-16T08:13:12.8837824Z
But I am able to access the blob when I hit the URL of blob.
I tried to reproduce the Same in my environment in got the same error as below:
To resolve this issue, try to give access in container url with SAS token like below:
And generate a SAS token and include it in below Url:
https://<storage-account-name>.blob.core.windows.net/<containername>?restype=container&comp=list&<sas-token>
When I ran the same, I got the result successfully like below:
Right click to your container folder and then select change access level and you are done!
I am trying to authenticate using the Azure Storage emulator's fixed account/key used for the Azure storage emulator Shared Key authentication.
When sending an anonymous request I get the correct response
but when adding Authorization Header I get:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<code>InvalidAuthenticationInfo</code>
<message xml:lang="en-US">Authentication information is not given in the correct format. Check the value of Authorization header.
RequestId:6d2cc79e-6bce-451c-a6f0-f10e0876f640
Time:2019-07-29T19:22:48.6402756Z</message>
</error>.
This is the key-value pair for the Authorization header:
Any idea on how to resolve this? I have followed documentation but no luck.
Considering you're using a Shared Access Signature (SAS) URL, you don't need to add Authorization header as authorization information is already included in your SAS URL (sig part of your URL).
One thing that you may want to do is change the value of Accept header and set its value to application/json;odata=fullmetadata.
Authorization header comes into picture when you don't use SAS. I noted that you're simply passing your account key as part of your authorization header. That won't work. You will actually need to compute the authorization header. Please see this link for more details: https://learn.microsoft.com/en-us/rest/api/storageservices/authorize-with-shared-key.
I have a storage account set up and a single container in it. The access level is set to public and I can access the individual blobs as so:
https://img.blob.core.windows.net/images/name_of_blob
However, when I try to access the URL of the container (images) directly:
https://img.blob.core.windows.net/images/
I get this response:
<Error>
<Code>ResourceNotFound</Code>
<Message>The specified resource does not exist.</Message>
</Error>
Is there a way to get a list of all the blobs within the container through a URL request?
How about using the REST API?
Something like:
GET https://myaccount.blob.core.windows.net/mycontainer?restype=container&comp=list
Be sure to pass in any required headers as per the documentation linked above.
When you created the container, the public access level must have been set at 'Blob'. If you set the public access level at 'Container' from the dropdown, you should be able to access the list.
I'm trying to create a table using this operation:
https://msdn.microsoft.com/en-us/library/azure/dd135729.aspx
with a json request body. However, all my efforts are rejected with the following response:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<code>JsonFormatNotSupported</code>
<message xml:lang="en-US">JSON format is not supported.
RequestId:41192a52-0002-007b-5334-b57662000000
Time:2016-05-23T20:48:17.4360778Z</message>
</error>
The error is mentioned here:
https://msdn.microsoft.com/en-us/library/azure/dd179438.aspx
But that's all I can find
Here's what I'm sending:
http://requestb.in/1l9sye21?inspect#1jmf39
I think the problem is that you need to add the x-ms-version header:
x-ms-version: 2015-04-05
This is required when using Shared Key / Shared Key Lite auth for the Table Service. See https://msdn.microsoft.com/en-us/library/azure/dd894041.aspx for more information.
Adding to Adam's answer: You need to specify Storage Service Versions in requests when authenticated.
For requests using Shared Key or Shared Key Lite, you must pass the x-ms-version header on the request.
For Requests using a Shared Access Signature (SAS), the SignedVersion (sv) parameter specifies the service version to use to authorize and authenticate.
See https://msdn.microsoft.com/en-us/library/azure/dd894041.aspx for more details.
The storage service version used to authenticate with may be incompatible with the version used to process the request, which will lead to some features such as json not available, thus the REST request fails with error (415) JSON format is not supported..
Refer to https://github.com/Azure/azure-storage-net/issues/32 for some information, though it's with SAS rather than SKA.
I want to Add service certificate to my CloudService of Azure via REST API. Currently I have this:
heres my Request Body: based on this documentation
<?xml version="1.0" encoding="utf-8"?>
<CertificateFile xmlns="http://schemas.microsoft.com/windowsazure">
<Data>MIIB3TCCAUagAwIBAgIQfgPuTBadfItGHpKyYRiRoTANBgkqhkiG9w0BAQUFADAtMSswKQYDVQQDHiIAYwBlAGQAdgBpAGwAbABcAGMAZQBkAHYAaQBsAGwAMAAwMB4XDTEzMDcxNTA4MjIwN1oXDTE0MDcxNTE0MjIwN1owLTErMCkGA1UEAx4iAGMAZQBkAHYAaQBsAGwAXABjAGUAZAB2AGkAbABsADAAMDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA2AB6hYWdqu/IG2Jo17tuHpmVsxNqGG5ROnNTtKZd4c7UtQ287EW5McRXqkfBmiwGIe3Pb3S0bd0q51YhT1WhQkGMMwwYLiAmALBct4OK3KNodl0t+rSO5R0Wq9YIaLq3o5HTGAR4wdKhaC/n1uJWPzD+TjkRRHnfEagWPtVjsMECAwEAATANBgkqhkiG9w0BAQUFAAOBgQCBLwjd3e1PaxvEy+Y1nqpTX8q/0ZsS2jVjCgRti0vehLGFlDEbL2rMhzGMo9zjQbXFzGCInMukFUhEI+OWkOBnBIIiYvTkKIFQWpLN7imIiRVuuqGFwslmESBySSO40M56jPXZ7/D0g8d8WDCfO1YoneDv4CuJE97lMTTyEjUJwg==</Data>
<CertificateFormat>cer</CertificateFormat>
</CertificateFile>
but it gives me error:The specified certificate's file format is invalid. The certificate file must be a Base64-encoded .pfx file.
Im certain about the certificate in Base64. What I did to get this is I used and upload manually the same My.cer file to different cloudservice and use List Service Certificate to view its Base64.
Simple answer to your problem is that Service Management API documentation is screwed up. Essentially the API does not care of CertificateFormat node and you have to always pass pfx there. You would also need to provide Password node as well with no value there because you're uploading a cer file. So based on all of this, please try the following as your request body:
<?xml version="1.0" encoding="utf-8"?>
<CertificateFile xmlns="http://schemas.microsoft.com/windowsazure">
<Data>MIIB3TCCAUagAwIBAgIQfgPuTBadfItGHpKyYRiRoTANBgkqhkiG9w0BAQUFADAtMSswKQYDVQQDHiIAYwBlAGQAdgBpAGwAbABcAGMAZQBkAHYAaQBsAGwAMAAwMB4XDTEzMDcxNTA4MjIwN1oXDTE0MDcxNTE0MjIwN1owLTErMCkGA1UEAx4iAGMAZQBkAHYAaQBsAGwAXABjAGUAZAB2AGkAbABsADAAMDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA2AB6hYWdqu/IG2Jo17tuHpmVsxNqGG5ROnNTtKZd4c7UtQ287EW5McRXqkfBmiwGIe3Pb3S0bd0q51YhT1WhQkGMMwwYLiAmALBct4OK3KNodl0t+rSO5R0Wq9YIaLq3o5HTGAR4wdKhaC/n1uJWPzD+TjkRRHnfEagWPtVjsMECAwEAATANBgkqhkiG9w0BAQUFAAOBgQCBLwjd3e1PaxvEy+Y1nqpTX8q/0ZsS2jVjCgRti0vehLGFlDEbL2rMhzGMo9zjQbXFzGCInMukFUhEI+OWkOBnBIIiYvTkKIFQWpLN7imIiRVuuqGFwslmESBySSO40M56jPXZ7/D0g8d8WDCfO1YoneDv4CuJE97lMTTyEjUJwg==</Data>
<CertificateFormat>pfx</CertificateFormat>
<Password></Password>
</CertificateFile>
Many thanks to #AzureCoder from http://elastacloud.com/ for putting me in the right direction.