Azure PUT Blob authentication fails in R

后端 未结 2 805
谎友^
谎友^ 2021-01-23 07:29

I would like to use R and the Azure Storage\'s Put Blob API to put files into my blob storage account but it fails to authenticate my request. Unfortunately, I couldn\'t find an

2条回答
  •  醉酒成梦
    2021-01-23 07:51

    I managed to resolve this issue by putting the "\n" characters and everything in the right place. Based on Gaurav Mantri's help, I used:
    https://docs.microsoft.com/en-us/rest/api/storageservices/authentication-for-the-azure-storage-services

    The following changes in the 'signature_string' worked:

    signature_string <- paste0("PUT", "\n",            # HTTP Verb
                               "\n",                   # Content-Encoding  
                               "\n",                   # Content-Language
                               content_length, "\n",   # Content-Length
                               "\n",                   # Content-MD5
                               "text/plain", "\n",     # Content-Type
                               "\n",                   # Date
                               "\n",                   # If-Modified-Since
                               "\n",                   # If-Match  
                               "\n",                   # If-None-Match
                               "\n",                   # If-Unmodified-Since
                               "\n",                   # Range
                               # Here comes the Canonicalized Headers
                               "x-ms-blob-type:BlockBlob","\n",
                               "x-ms-date:",requestdate,"\n",
                               "x-ms-version:2015-02-21","\n",
                               # Here comes the Canonicalized Resource
                               "/",account, "/",container,"/", filename)
    

提交回复
热议问题