I have the following HTTParty request as per the Azure blob upload API:
#<HTTParty::Request:0x0000000106424558
@changed_hosts=false,
@credentials_sent=false,
@http_method=Net::HTTP::Put,
@last_uri=#<URI::HTTPS https://<account name>.blob.core.windows.net/<container name>/txt-blob>,
@options=
{:limit=>5,
:assume_utf16_is_big_endian=>true,
:default_params=>{},
:follow_redirects=>true,
:parser=>HTTParty::Parser,
:uri_adapter=>URI,
:connection_adapter=>HTTParty::ConnectionAdapter,
:headers=>
{"User-Agent"=>"Httparty",
"x-ms-date"=>"Tue, 11 Jul 2023 14:06:07 GMT",
"x-ms-version"=>"2018-11-09",
"DataServiceVersion"=>"1.0;NetFx",
"MaxDataServiceVersion"=>"3.0;NetFx",
"Content-Type"=>"application/atom+xml; charset=utf-8",
"x-ms-blob-type"=>"BlockBlob",
"x-ms-blob-content-type"=>"text/plain; charset=ASCII-8BIT",
"Content-Length"=>"5",
"Content-MD5"=>"2Oj8otwPiW/Xy0ywAxuiSQ==",
"Authentication"=>"SharedKey <account name>:<signed string base64>"},
:body=>"test\n"},
@path=#<URI::HTTPS https://<account name>.blob.core.windows.net/<container name>/txt-blob>,
@raw_request=#<Net::HTTP::Put PUT>>
I am getting a response like this:
<Error><Code>ResourceNotFound</Code><Message>The specified resource does not exist
I suspect it's because the storage account is treating this like an anonymous request, but I'm not sure how to change that or figure out on the Azure end why the request fails(I'm having trouble seeing the request logs).
Is there anything wrong with the way I am constructing this request? How can I change it so that the server knows it's a SharedKey auth scheme, not anonymous?
I noticed that you are using
Authenticationas the header name in your code:Please note that the name of the header is
Authorization. Please try by changingAuthenticationheader name toAuthorization.