question

Ashish-243d avatar image
0 Votes"
Ashish-243d asked Ashish-243d edited

Blob SAS URI character decoded when passed as Query parameter to Azure Function app

I wanted to pass the SAS URI of a image file to Azure Functions as query parameters.
But when I pass the below URL, some characters from 'sig' part get decoded

https://ABCD.blob.core.windows.net/images/test.jpg?sp=r&st=2021-05-06T11:30:21Z&se=2022-05-06T19:30:21Z&spr=https&sv=2020-02-10&sr=b&sig=JuPyAR%2F5WNeSVXj4G%2Fft9QDMzL%2BtXSywSS375jZpjXQ%3D

The above URL becomes
https://ABCD.blob.core.windows.net/images/test.jpg?sp=r&st=2021-05-06T11:30:21Z&se=2022-05-06T19:30:21Z&spr=https&sv=2020-02-10&sr=b&sig=JuPyAR/5WNeSVXj4G/ft9QDMzL+tXSywSS375jZpjXQ=


%2F to /
%2B to +
%3D to =

Because of this when I try to access the blob, I get error:
System.Private.CoreLib: Exception while executing function: <FUNCTIONNAME>. System.Net.Requests: The remote server returned an error: (403) Server failed to authenticate the request. Make sure
the value of Authorization header is formed correctly including the signature..

I am accessing the URI using below code

string image = req.Query["image"];


azure-functions
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Ashish-243d avatar image
0 Votes"
Ashish-243d answered Ashish-243d edited

Got a solution.
Encode the URL into BASE64 and then send to Function app, and inside Function app, decode the encoded string to get the URL as it is.

https://stackoverflow.com/questions/67417681/blob-sas-uri-character-decoded-when-passed-as-query-parameter-to-azure-function

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.