Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: How to send file to Azure? [Auth error 403]


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 1 - Last Post: Jul 20, 2016 3:58 AM Last Post By: Dawid Najgiebauer
Dawid Najgiebauer

Posts: 4
Registered: 11/24/11
How to send file to Azure? [Auth error 403]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 12, 2016 4:39 AM
hi,

I have following information about my azure:
{"RequestToUploadFileList":[{"BlobName":"c49fdbbb-3c53-444b-9201-dc629dce3a2e",
"Url":"https://taxdocumentstorage.blob.core.windows.net/decd9ef20264b174000000b05db11797/c49fdbbb-3c53-444b-9201-dc629dce3a2e?sv=2015-07-08&sr=b&si=decd9ef20264b174000000b05db11797&sig=QbeASUGFf9t%2BGbWzcEMm2F2Lc1%2BhvVGShpF8wBy7ABM%3D",
"Method":"PUT",
"HeaderList":[{"Key":"Content-MD5","Value":"twWOFU4xRB/stqTM8+qfWQ=="},
{"Key":"x-ms-blob-type","Value":"BlockBlob"}]}]}

Now, how to use it?
I try like this:
	conn := TAzureConnectionInfo.Create(nil);
	resp := TCloudResponseInfo.Create;
	try
		conn.Protocol := 'https';
		conn.UseDevelopmentStorage := False;
 
		srv := TAzureBlobService.Create(conn);
		try
					fsData := TFileStream.Create(FileData.FileName, fmOpenRead or fmShareDenyWrite);
					try
						conn.AccountName := 'taxdocumentstorage';
						Headers.Add('Content-MD5=twWOFU4xRB/stqTM8+qfWQ==');
						Headers.Add('x-ms-blob-type=BlockBlob');
						queryparams.Add('sv=2015-07-08');
						queryparams.Add('sr=b');
						queryparams.Add('si=decd9ef20264b174000000b05db11797');
						queryparams.Add('sig=QbeASUGFf9t+GbWzcEMm2F2Lc1+hvVGShpF8wBy7ABM=');
 
						try
							SetLength(a, fsData.Size);
							fsData.Position := 0;
							fsData.ReadBuffer(a[0], fsDAta.Size);
							Result := srv.PutBlockBlob('decd9ef20264b174000000b05db11797', 'c49fdbbb-3c53-444b-9201-dc629dce3a2e', a, '', Headers, queryparams, resp);
						except
							on E: Exception do
							begin
								Exit(False);
							end;
						end;
					finally
						fsData.Free;
					end;
		finally
			srv.Free;
		end;
	finally
		conn.Free;
		resp.Free;
	end;

And in response get 403 error - Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
And detail:
The MAC signature found in the HTTP request 'fdHhWO+BwHo0NKeimUBC4JUXFgUlSRMXPsNa3qeGNBY=' is not the same as any computed signature. Server used following string to sign: 'PUT
k5e7VI1wlBuSY1UYvVlLbQ==
 
 
x-ms-blob-type:BlockBlob
x-ms-date:Tue, 12 Jul 2016 13:15:03 GMT
/taxdocumentstorage/decd9ef20264b174000000b05db11797/c49fdbbb-3c53-444b-9201-dc629dce3a2e'


What do I wrong?

Edited by: Dawid Najgiebauer on Jul 12, 2016 6:18 AM

Edited by: Dawid Najgiebauer on Jul 20, 2016 3:58 AM
Dawid Najgiebauer

Posts: 4
Registered: 11/24/11
Re: How to send file to Azure? [Auth error 403]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 13, 2016 3:42 AM   in response to: Dawid Najgiebauer in response to: Dawid Najgiebauer
Many try and tests another case shows, that Delphi's 10 native code is not compatible with this version of Azure!

How/where can I find correctly version of AzureService codes? Will be changed?
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02