zockette opened a new issue #19409:
URL: https://github.com/apache/airflow/issues/19409


   ### Apache Airflow Provider(s)
   
   microsoft-azure
   
   ### Versions of Apache Airflow Providers
   
   apache-airflow-providers-microsoft-azure 3.2.0
   apache-airflow-providers-microsoft-azure 3.3.0rc1
   
   ### Apache Airflow version
   
   2.1.2
   
   ### Operating System
   
   Red Hat Enterprise Linux Server release 7.9 (Maipo)
   
   ### Deployment
   
   Virtualenv installation
   
   ### Deployment details
   
   Using Azure Blob Storage connection (wasb.py) hook with SAS Token.
   
   ### What happened
   
   While trying to upload a file to blob storage via 
airflow.providers.microsoft.azure.transfers.local_to_wasb.LocalFilesystemToWasbOperator
 with a SAS Token, the task always fails on 
"container_client.create_container()" in the wrong way.
   
   The underlying azure/storage/blob/_container_client.py create_container 
doesn't return a "ResourceExistsError" but a generic 
"azure.core.exceptions.HttpResponseError: The requested URI does not represent 
any resource on the server." instead.
   
   
   ### What you expected to happen
   
   The setup of "try to create, if it fails with a specific error it's ok, 
otherwise, go kaboom" should probably handle more error types.
   
   
   Given what I've seen with blob management with SAS token in my Azure 
adventures, I suspect the setup doesn't handle the container name being already 
part of the SAS token path.
   
   ### How to reproduce
   
   Get yourself an Azure Blob Storage Container with a SAS Token.
   Setup an Azure Blob Storage connection in Airflow.
   => Make sure you input the SAS Token in both the "Extra" field's 
extra__wasb__sas_token key and in the "SAS Token (optional)" field. Otherwise 
you're going to have a bad time (and if you're using 3.2.0 you'll have to patch 
the code, works out of the box with 3.3.0rc1).
   Run an operator like this: 
LocalFilesystemToWasbOperator(dag=dag,task_id='upload_to_blob_storage', 
file_path='/tmp/lalala.txt', 
container_name="this_actually_acts_as_a_path_within_the_blob_and_not_as_a_container_its_MAGIC",blob_name='hihi.txt',
 wasb_conn_id='name_of_connection')
   
   
   
   ### Anything else
   
   Given what I've seen with blob management with SAS token in my Azure 
adventures, I suspect the setup doesn't handle the container name being already 
part of the SAS token path.
   
   But I couldn't say whether the Azure Python SDK is to blame or if it should 
be handled in the Airflow provider :(
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to