user12460590
user12460590

Reputation:

Connecting to Azure Blob Storage from R with SAS-URI "only"

I am trying to connect to Azure Blob Storage using the "AzureStor" package. I only have a SAS URI to my storage account.

Get the message: "Bad Request (HTTP 400). Failed to complete Storage Services operation. Message: InvalidUri. The requested URI does not represent any resource on the server."

In the Microsoft Azure Storage Explorer the URI works.

This is my code

library(AzureStor)

end_point <- blob_endpoint("https://storagename.blob.core.windows.net/myname/",
                      sas = "sv=2018-xxxx0SCdi8aO6%2FyYzT0dHHPca0KhyNrFHtE%3D")

list_blob_containers(end_point)

Upvotes: 0

Views: 1032

Answers (1)

Gaurav Mantri
Gaurav Mantri

Reputation: 136356

I believe you're getting this error is because you're trying to use a blob container URL to list blob containers.

Please try by changing your code to something like:

library(AzureStor)

end_point <- blob_endpoint("https://storagename.blob.core.windows.net/",
                      sas = "sv=2018-xxxx0SCdi8aO6%2FyYzT0dHHPca0KhyNrFHtE%3D")

list_blob_containers(end_point)

Please do note that listing blob containers using SAS token would require you to get an Account SAS token with list permission at the Service level. At the very least, your SAS token should have:

Signed Service (ss): Blob Service (b)

Signed Resource Types (srt): Service (s)

Signed Permission (sp): List (l)

If you do not have these, your list blob containers operation will fail.

Upvotes: 3

Related Questions