Title: Shared Access Signature URL returns The requested URL does not represent any resource on the server
Tags: azure;azure-blob-storage
Question: using my Visual Studio Enterprise subscription, I can create a SAS from a blob.
It looks like this. I created this from console, so quite confident about it
https://[mystorageaccounthere].blob.core.windows.net/[thecontainernamehere]?sp=r&amp;st=2022-02-02T21:25:10Z&amp;se=2022-02-03T05:25:10Z&amp;spr=https&amp;sv=2020-08-04&amp;sr=c&amp;sig=[the signtaure]
Then I try out a sample taken from Azure Storage samples to get the properties.
Uri mySASUri = new Uri(Environment.GetEnvironmentVariable(&quot;SAS_URL&quot;));
BlobServiceClient service = new BlobServiceClient(mySASUri);
await service.GetPropertiesAsync();
Result is an exception
Unhandled exception. Azure.RequestFailedException: The requested URI does not represent any resource on the server.
any ideas
Thanks to all who look into this
Comment: Please edit your question and include the SAS URL. Do obfuscate the account name and sig portion before sharing.

Comment: Thanks @GauravMantri

Here is the accepted answer: The reason you are getting this error is because you are using an incorrect type of SAS token (URL). You are creating a SAS token on the container which is a Service SAS kind of token which will only work on the container (or blob) for which The SAS token is acquired.
Considering BlobServiceClient.GetPropertiesAsync() is an account level operation, you would need to create an Account SAS token and use that to perform this operation.
Please create an Account SAS URL with at least read permission and use that in your code and you should not get this error.


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 2, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2022:00:02/02/22', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<azure><azure-blob-storage>', 'Title': 'Shared Access Signature URL returns The requested URL does not represent any resource on the server', 'ViewCount': 145, 'id': 70962733, 'user_AboutMe': None, 'user_AccountId': 17906646.0, 'user_DisplayName': 'Tauqir', 'user_Reputation': 167.0, 'user_Views': 61.0, 'user_id': 13009630.0}}