1
curl -v -X GET 'https://outboundproxy.xx.net:8443/<Container_name>/<SAS>Token' -H 
'Host: Azurestorage.blob.core.windows.net' -H "Rest of the curl 
headers"

We have a outbound proxy inplace and all of the external connection has to go via an 'https://outboundproxy.xx.net:8443'. Hence, In the above curl command i have used host header to pass the actual storage account base url.

Now, I want to replicate it using the python Azure blob SDK module but I am not sure how to structure the account url parameter. Any pointer or hint will be helpful

Ecstasy
  • 1,866
  • 1
  • 9
  • 17

1 Answers1

0

Now, I want to replicate it using the python Azure blob SDK module but I am not sure how to structure the account url parameter. Any pointer or hint will be helpful

As per discussion between jalauzon and Jagadishbobadeg, adding gist as a community wiki to help community members who might face a similar issue.

  • While trying to add SAS token in a connection string, use SharedAccessSignature
  • Instead of using container name in URL, just use root endpoint URL.
from azure.storage.blob import BlobServiceClient
conn = 'DefaultEndpointsProtocol=https;BlobEndpoint=https://********.net:8443/;AccountName=<StorageName only>;SharedAccessSignature=sp=rl&st=2022-04-08T11:54:32Z&se=2022-05-08T19:54:32Z&spr=https&sv=2020-08-04&sr=c&sig=*****************************'

blob_service_client = BlobServiceClient.from_connection_string(conn)
headers = {'Host': '************************.blob.core.windows.net'}
container_client = blob_service_client.get_container_client(<Container_Name>)
containers = container_client.list_blobs(headers=headers)

Reference: Acquire a connection to a Blob storage via outbound reverse proxy settings

Ecstasy
  • 1,866
  • 1
  • 9
  • 17