Skip to content

Generate SAS tokens with get_service_sas or get_account_sas #140

@dempseynoel

Description

@dempseynoel

I'm trying to generate SAS tokens using the two functions mentioned above. Using example code in the docs (below) a SAS token is generated, however when I append this to the end of the blob I want to access I get an error stating the signature did not match.

I generate the SAS as follows:

endp <- storage_endpoint(Sys.getenv("LONDON_BUS_STORAGE_ENDPOINT"), key=Sys.getenv("LONDON_BUS_STORAGE_KEY"))

sas <- get_service_sas(endp, resource = Sys.getenv("LONDON_BUS_ANNOTATE_CONTAINER_NAME"), permissions="r")

blob_file_url_with_sas <- paste0(Sys.getenv("LONDON_BUS_STORAGE_ENDPOINT"), "/", Sys.getenv("LONDON_BUS_ANNOTATE_CONTAINER_NAME"), "/", Sys.getenv("LONDON_BUS_ANNOTATE_FILE"), sas)

Where the environmental variables relate to the storage account, storage account key, container name, and the name of the blob.

The error is:

<Error> <Code>AuthenticationFailed</Code> <Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. RequestId:2b7236bd-301e-004c-2d6b-757ef4000000 Time:2024-03-13T17:22:19.7678924Z</Message> <AuthenticationErrorDetail>Signature did not match. String to sign used was r 2024-03-13T17:07:02Z 2024-03-14T01:07:02Z /blob/{{MY_STORAGE_ACCOUNT}}/{{MY_CONTAINER}} 2021-06-08 c </AuthenticationErrorDetail> </Error>

When I generate a SAS token in the GUI in my Azure account everything works. I'm only trying to generate with AzureStor so that I can generate frequently for extra security.

Any help on this is much appreciated. I've tried numerous variations of the SAS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions