Closed StannieV closed 1 year ago
Hi @StannieV , just wanted to clarify are you seeing this error when using the Python SDK or the .NET one ? If its the latter then the .net repo is located here
You are right, it is in the .Net library. I'll close this topic and created a new one in the .net repo.
Describe the bug
In my solution, I want to create a SAS Uri for a blob item that is accessed via an Azure Front Door (AFD) endpoint. The blob container cannot be publicly accessible and therefore the SAS is needed. After creating a SAS for a blob item, you can replace the hostname of the blob URL E.g ‘https://.blob.core.windows.net’ (from the complete SAS) with the hostname of the AFD endpoint. E.g: ‘https:// .z01.azurefd.net’. With this new URL, you can access the blob item (even download it in the browser) through the AFD endpoint and use CDN.
In code, it seemed a clumsy solution first to create a SAS and then replace the hostname of the URL in the code. After some searching, I found a solution in creating a ‘BlobServiceClient’ with a different service URL, which points to the AFD endpoint. At first glance, this seems great. With this, I only have to change the initialization of the blob object(s) in my startup logic and keep my logic in the application the same. Unfortunately, this is not always working. In half of the cases, it works and in the other half, an exception is thrown in the code.
Why is this exception thrown and should it work as I intend? Or, are there better alternatives for what I want to achieve?
The exception that is produced is:
The following C# code reproduces (sometimes) the exception:
Project file:
The following BICEP script creates the Storage Account and the Azure Front Door (I composed it from multiple files so it isn’t production code):